java - Can't use mysql driver with Wildfly 9.0.2 however It seems like it's loaded correctly -
i'm trying switch wildfly glassfish i'm getting hard time set connection mysql db. have placed .jar , module.xml under /wildfly-9.0.2.final/modules/system/layers/base/com/mysql/driver/main.
the content of module.xml:
<?xml version="1.0" encoding="utf-8"?> <module xmlns="urn:jboss:module:1.1" name="com.mysql.driver"> <resources> <resource-root path="mysql-connector-java-5.1.38-bin.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>
in standalone.xml i've added entry:
<driver name="mysql" module="com.mysql.driver"> <driver-class>com.mysql.jdbc.driver</driver-class> </driver>
and here comes fun part, when run ./standalnole.sh there no error @ all. says mysql driver stared, on management interface under datasources - detected drivers don't see it, original h2 driver.
[0m13:22:59,551 info [org.jboss.as.connector.deployers.jdbc] (msc service thread 1-3) wflyjca0018: started driver service driver-name = mysql
do know solution problem?
i installed postgresql-driver , module using commandline interface. ended in .../wildfly-9.0.2.final/modules/org/postgresql/main/
. thats different place have used, not know if that's problem here.
your xml ok me, driver jar , module.xml file perhaps not in correct place. try use cli install it. here how installed driver , created datasource it:
module add --name=org.postgresql --resources=/users/jonmartinsolaas/downloads/postgresql-9.4.1207.jar --dependencies=javax.api,javax.transaction.api
when adding module jar-files copied wildfly. if need more 1 jar, use : list separator.
data-source add \ --name=myds \ --driver-name=postgresql \ --jndi-name=java:jboss/datasources/myds \ --connection-url="jdbc:postgresql://localhost/my-db" \ --user-name=username \ --password=secret \ --use-ccm=false \ --max-pool-size=25 \ --blocking-timeout-wait-millis=5000 \ --new-connection-sql="set datestyle = iso, european;" \ --check-valid-connection-sql="select 1" \ --enabled=true
and if need xa datasource:
batch xa-data-source add \ --name=mydsxa \ --driver-name=postgresql \ --jndi-name=java:jboss/datasources/mydsxa \ --user-name=username \ --password=secret \ --recovery-username= username \ --recovery-password = secret \ --check-valid-connection-sql="select 1" \ --use-ccm=false \ --max-pool-size=25 \ --blocking-timeout-wait-millis=5000 \ --new-connection-sql="set datestyle = iso, european;" \ --enabled=true /subsystem=datasources/xa-data-source=paddaxa/xa-datasource-properties=servername:add(value=localhost) /subsystem=datasources/xa-data-source=paddaxa/xa-datasource-properties=portnumber:add(value=5432) /subsystem=datasources/xa-data-source=paddaxa/xa-datasource-properties=databasename:add(value=my-db) run-batch
note xa definition runs batch (sort-of transaction) have "commit" using run-batch
.
Comments
Post a Comment