JBoss 7 MySQL datasource issue - java

I'm trying to create a datasource in JBOSS 7.
My standalone.xml excerpts:
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/sampledb</connection-url>
<driver>mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<prefill>true</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>root</user-name>
<password>matrix</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
and I have created module/com/mysql/main directory and have put mysql jar there along with module.xml which is as below:
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-3.0.17-ga-bin.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
and my persistence.xml uses this datasource
<jta-data-source>java:/MySqlDS</jta-data-source>
But the server start throws the error message as below.
New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysql (missing)
Could you please help ?
Thanks.

This will help you to fix the problem.
Jboss and mysql connector

See https://zorq.net/b/2011/07/12/adding-a-mysql-datasource-to-jboss-as-7/

Is the version of driver. Change for a new version. Believe, is only it!!!
I changed the driver mysql-connector-java-5.0.4-bin.jar for mysql-connector-java-5.1.25-bin.jar, then the problem is solved.

For me, after checking over and over that all of the module.xml and standalone.xml parameters where right. I realised i was using mysql-connector-java-xxx-bin.jar ...Changed it to a non bin jar and it MAGICALLY worked :D

Related

Not able to create mysql datasource in Jboss 7.1.1

I am using jboss as 7.1.1 final release. I am trying to add mysql driver to the server via the admin console. I am able to do so but when I go to create the datasources, I do not find the driver listed there. I followed the steps to add the driver to the server as mentioned in this link :
http://www.appeon.com/support/documents/appeon_online_help/1.5/server_configuration_guide_for_j2ee/ch03s03s03.html#d0e4128
I followed from step 3 of Installing a JDBC driver via the Web console as I had already created one management user.To summarize what I did,
I added a driver file E:\DevSoftwares\servers\jboss\jboss-as-7.1.1.Final\modules\com\mysql\main\META-INF\services\java.sql.Driver and its content as following : com.mysql.jdbc.jdbc2.optional.MysqlXADataSource(fully qualified driver class name).
create module.xml file inside E:\DevSoftwares\servers\jboss\jboss-as-7.1.1.Final\modules\com\mysql\main\ and its content as below :
Added mysql-connector-java-5.0.8-bin.jar file inside E:\DevSoftwares\servers\jboss\jboss-as-7.1.1.Final\modules\com\mysql\main\
Ran jar -uf mysql-connector-java-5.0.8-bin.jar META-INF\services\java.sql.Driver command to modify the jar.
After running this command I could see a services\java.sql.Driver file with driver class name as given in step 1 inside META-INF folder of the jar file which was not there before running the command.
I picked up the fully qualified name of the driver class for mysql for Jboss 7.x from below link :
http://www.appeon.com/support/documents/appeon_online_help/1.5/server_configuration_guide_for_j2ee/ch03s03s07.html#d0e5769
I was able to figure out what is causing the problem, when I try to enable the deployed jar I get an exception in the server console stating : unable to instantiate driver class com.mysql.jdbc.jdbc2.optional.MysqlXADataSource :
java/lang.ClassCastException :
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.
However I checked the mysql-connector-java-5.0.8-bin.jar and was able to find the driver class mentioned above in the same directory structure as the classes fully qualified name.
I am not able to figure out why I am getting this exception or what I am doing wrong during the setup that is causing this issue.The platform I am using is windows. Could some one please help me with it.
NOTE : the content of module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.0.8-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>`
Please check that you have added your MySQL datasource configuration in standalone.xml or in equivalent XML file:-
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/MySqlExampleDS" pool-name="MySqlExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/jboss7db</connection-url>
<driver>mysql</driver>
<pool>
<max-pool-size>30</max-pool-size>
</pool>
<security>
<user-name>root</user-name>
<password>admin</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>

JBOSS AS 7.1 JBAS014775: New missing/unsatisfied dependencies:

My application connects to a postgresql database, but when I start my jboss a
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.postgresql-9_4_1208_jre7_jar (missing)
dependents: [service jboss.data-source.java:jboss/postgresDS]
How do I fix this? and when I continue with my application despite the missing dependencies, I got a java.lang.ClassNotFoundException: org.postgresql.Driver exception
I have been searching for a solution for hours but I can't still fix the issue.
standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jta="false" jndi-name="java:jboss/postgresDS" pool-name="postgresDS" enabled="true" use-ccm="false">
<connection-url>jdbc:postgresql://localhost:5432/testdb</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql-9.4.1208.jre7.jar</driver>
<security>
<user-name>postgres</user-name>
<password>test</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<background-validation-millis>0</background-validation-millis>
</validation>
<statement>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="postgresql-9.4.1208.jre7.jar" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
module/xml on my /jboss-as-7.1.0.Final/modules/org/postgresql/main
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" xmlns="urn:jboss:domain:datasources:1.0" name="org.postgresql">
<resources>
<resource-root path="postgresql-9.4.1208.jre7.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
I'm using servlets, jsp and jdbc.
You need to add a jboss-dependencies,xml file with a module dependency on the org.postgresql module. You can also do this with a MANIFEST.MF. Both files are placed in the WAR's META-INF dir.

Wildfly 10 failing to load MySQL XA driver on startup

I have a web application I am deploying in wildfly-10.0.0. It requires a mysql xa driver. I have the following error:
2015-10-13 12:25:37,979 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "com.mysql")
]) - failure description: "WFLYJCA0041: Failed to load module for driver [com.mysql]"
The modules directory is as follows:
Directory of C:\Users\rball\Documents\Dev\WildFly\wildfly-10.0.0.CR1\modules\sy
stem\layers\base\com\mysql\main
10/13/2015 11:32 AM <DIR> .
10/13/2015 11:32 AM <DIR> ..
10/13/2015 12:25 PM 1,575 module.xml
03/17/2015 05:21 AM 968,670 mysql-connector-java-5.1.35-bin.jar
The module.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.35-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
I added the driver and datasource to the datasources section of standalone.xml:
<xa-datasource jndi-name="java:/jdbc/MyXaDS" pool-name="MyXaDSPool" enabled="true" use-ccm="false">
<xa-datasource-property name="URL">
jdbc:mysql://localhost:3306/temp?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
</xa-datasource-property>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
<driver>com.mysql</driver>
<xa-pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<is-same-rm-override>false</is-same-rm-override>
<interleaving>false</interleaving>
<pad-xid>false</pad-xid>
<wrap-xa-resource>false</wrap-xa-resource>
</xa-pool>
<security>
<user-name>root</user-name>
<password>password</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<background-validation-millis>1000</background-validation-millis>
</validation>
<statement>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</xa-datasource>
<drivers>
<driver name="com.mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
The error you get means that wildfly expects a module called com.mysql but it doesn't exist or it isn't registered under that name.
You are missing one step, which is registering the datasource jdbc driver. The first step of course being adding the mysql-connector-java-5.1.35-bin.jar file and module.xml file in WILDFLY_HOME\modules\system\layers\base\com\mysql\main.
To get rid of your error, stop wildfly, delete the the driver declaration in your standalone.xml by removing these lines; We'll let the /subsystem command create this entry.
<driver name="com.mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
Open your command prompt and navigate to WILDFLY_HOME\bin\ and run the following commands.
Connect to jboss cli by running : jboss-cli.bat --connect . In case your management console is running on a different port say , localhost:9991, use jboss-cli.bat --connect --controller=127.0.0.1:9991
Then register the jdbc-driver with the following command
/subsystem=datasources/jdbc-driver=com.mysql:add(driver-name=com.mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)
You should get the response {"outcome" => "success"} if this was successful.
From there, reload your server and you should get rid of that error.
I got pointers from This link
I'm not really sure what the issue could be. The message isn't very informative.
That said the following add-mysql.cli script worked for me.
module add --name=com.mysql --resources=~/Downloads/mysql-connector-java-5.1.37/mysql-connector-java-5.1.37-bin.jar --dependencies=javax.api,javax.transaction.api
batch
/subsystem=datasources/jdbc-driver=com.mysql:add(driver-name=com.mysql, driver-module-name=com.mysql, driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)
/subsystem=datasources/xa-data-source=mysql:add(driver-name=com.mysql, jndi-name="java:/jdbc/MySQLXA", enabled=true)
/subsystem=datasources/xa-data-source=mysql/xa-datasource-properties=URL:add(value="jdbc:mysql://localhost:3306/temp?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8")
run-batch
I didn't write all the properties defined in your data source configuration, but this did work.
WildFly 10 has some change in jca caused CLI create xa ds have some issue.
https://issues.jboss.org/browse/WFLY-6773
https://issues.jboss.org/browse/WFLY-6789
https://issues.jboss.org/browse/WFLY-6774
But create xa datasouces use below commands works
xa-data-source add --name=MariaDBXADS --driver-name=mariadb-xa --jndi-name=java:jboss/datasources/MariaDBXADS --user-name=jdv_user --password=jdv_pass --use-java-context=true --xa-datasource-properties=[DatabaseName=>products, PortNumber=>3306, ServerName=>localhost]
WILDFLY 10 using MySQL 5.7
Follow these steps: comment or delete exampleds in standalone.xml
into jboss-cli.bat --connect
After execute command:
[standalone#localhost:9990 /] /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)
should be ok.
This modified standalone.xml, then add:
<datasources>
<!--
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
-->
<datasource jndi-name="java:/mysql" pool-name="mysqlDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/wildfly</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>jdfoxito10</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
should look like!
and module.xml put in
\java\server\wildfly-10.1.0.Final\modules\system\layers\base\com\mysql\main
mysql-connector-java-5.1.40-bin.jar (come installer mysql-installer-community-5.7.15.0.msi) module.xml
and content from module.xml like:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.40-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
and ready, JAVA_HOME should be ok

How do i set up datasource on Jboss 6 EAP for as400 db2?

I am trying to setup a jboss 6.3 data-source to an ibm as400
jboss 6.3 is running on a windows server 2012 VM
java 1.8.0_31 64 bit
i am getting this error in the console on start up of jboss
1
4:02:09,332 INFO [org.jboss.as.controller] (Controller Boot Thread)
JBAS014774: Service status report JBAS014775: New
missing/unsatisfied dependencies:
service jboss.jdbc-driver.as400 (missing) dependents: [service jboss.driver-demander.java:jboss/datasour ces/PPSDB, service
jboss.data-source.java:jboss/datasources/PPSDB]
this is my module.xml i have it and the driver jt400.jar in
D:\Program Files\jboss-eap-6.3\modules\com\ibm\as400\main
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<module xmlns="urn:jboss:module:1.0" name="com.ibm.as400">
<resources>
<resource-root path="jt400.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
This is the datasource subsystem from my Standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:1.1">
<datasources>
<datasource jndi-name="java:jboss/datasources/PPSDB" pool-name="java:jboss/datasources/PPSDB_Pool" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:as400://development.ad.company.com/JKCDRIVER;DB_CLOSE_DELAY=-1</connection-url>
<driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
<driver>as400</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>user</user-name>
<password>password</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<use-fast-fail>false</use-fast-fail>
</validation>
</datasource>
<drivers>
<driver name="as400" module="com.ibm.as400"/>
</drivers>
</datasources>
</subsystem>
i have found a few different examples for setting up an as400 data-source on old versions of jboss, but the tags seem to have changed, and i have not been able to figure out how to get this working
https://developer.jboss.org/wiki/SetUpADB2Datasource
any help would be greatly appreciated
I moved the driver-class tag inside the driver tag like suggested in the answer below, removed the data source from the standalone.xml, then using the jboss web console added the data source. That generated this in the standalone.xml
<datasource jta="false" jndi-name="java:/jdbc/ppsdb" pool-name="mypool" enabled="true" use-ccm="false">
<connection-url>jdbc:as400://development.ad.company.com/JKCDRIVER</connection-url>
<driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
<driver>as400</driver>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<timeout>
<set-tx-query-timeout>false</set-tx-query-timeout>
<blocking-timeout-millis>0</blocking-timeout-millis>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>0</query-timeout>
<use-try-lock>0</use-try-lock>
<allocation-retry>0</allocation-retry>
<allocation-retry-wait-millis>0</allocation-retry-wait-millis>
</timeout>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
now its working great, thanks
Make sure your 'jt400.jar' is on the path \modules\com\ibm\as400\main
Your module.xml should read like
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.ibm.as400">
<resources>
<resource-root path="jt400.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
In your Driver tag add the driver-class child
<driver name="as400" module="com.ibm.as400">
<driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
</driver>

New missing/unsatisfied dependencies: service jboss.jdbc-driver.com_mysql (missing) dependents: [service jboss.data-source.java:jboss/MyDB]

I am using JBoss 7.1.1. When I try to start the server, I get an exception. I have tried many solutions but nothing seems to work.
The following line appears in the logs -
New missing/unsatisfied dependencies:
service jboss.jdbc-driver.com_mysql (missing) dependents: [service jboss.data-source.java:jboss/MyDB]
Here is my standalone.xml:
</datasource>
<datasource jta="true" jndi-name="java:jboss/MyDB" pool-name="MyDB_Pool" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver>com.mysql</driver>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
<timeout>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>600</query-timeout>
</timeout>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
This is my module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.24-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
<module name="javax.validation.api"/>
</dependencies>
</module>
But i still got this exception
Here is my web.xml(a part of it):
<resource-ref id="ResourceRef_1">
<res-ref-name>MyDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
<lookup-name>java:jboss/datasources/MyDB</lookup-name>
</resource-ref>
Can anyone help?
Your module.xml should be like this:
<module xmlns="urn:jboss:module:1.0" name="com.mysql" slot="main">
<resources>
<resource-root path="mysql-connector-java-5.1.24-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
And make sure you have mysql-connector-java-5.1.24-bin.jar and mysql-connector-java-5.1.24-bin.jar.index in same folder where you have module.xml.
Solved: New missing/unsatisfied dependencies: service jboss.jdbc-driver.com_ for Jboss / WildFly 10
Hi,
first stop the WildFly server.
then update standalone.xml file to add MS-SQL JTDS driver details and Datasource details like below:
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
<datasources>
<datasource jta="true" jndi-name="java:/jdbc/speedtest-datasource" pool-name="MSSQLDSspeedTestDEV" enabled="true" use-ccm="true">
<connection-url>jdbc:jtds:sqlserver://serverName:1433;DatabaseName=dbName</connection-url>
<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
<driver>JTDS</driver>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
<background-validation>true</background-validation>
</validation>
</datasource>
<drivers>
<driver name="JTDS" module="net.sourceforge">
<driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
Module.xml for MS SQL JTDS: path : E:\Softwares\wildfly-10.1.0.Final\wildfly-10.1.0.Final\modules\system\layers\base\net\sourceforge\main ( need to create directory structure as highlighted and add module.xml and jtds-1.3.0.jar files).
(note in this example i have used module name as "net.sourceforge" and created the folder structure path as "net\sourceforge\main"). Please note this is more important to match the directory path and module name in module,xml file.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="net.sourceforge">
<resources>
<resource-root path="jtds-1.3.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Note: Please note that the path highlighted in green above at 2 places should match (ie directory structure and module name in module.xml),
For example. If you have created directory structure as E:\Softwares\wildfly-10.1.0.Final\wildfly-10.1.0.Final\modules\system\layers\base\net\sourceforge\jtds\main then module name in module.xml file should be “net.sourceforge.jtds” as shown below in module.xml file
Module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="net.sourceforge.jtds">
<resources>
<resource-root path="jtds-1.3.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
now save these two files and restart the wildFLY server.
Regards,
Rasool Javeed Mohammad
javeed.mca#gmail.com
try upgrading your mysql-connector. i was trying to deploy 5.1.5 (i was migrating from jboss 5.1 to 7.1.1 so i was just moving an already working environment over to the newer container). after banging my head against this for two days, i upgraded to 5.1.27 and the datasource deployed like a champ.
Try to delete META-INF/services/java.sql.Driver from the mysql connector lib.
One thing to check with this error is to make sure you are storing the data in the correct folder. For JBoss EAP 7.1, it is the modules\system\layers\base\com folder. Inside of the com folder, create an additional folder called mysql and a main folder inside of the mysql folder. The main folder will hold the jar file and the module.xml file.
Try below steps. i solve the same problem with you in wildfly8.0.0-final. if there occurs that duplicate mysql dependencies, remove configuration firstly, after restart your computer, try the steps again.
1. Create mysql folder
under: ${WILDFLY_HOME}/modules/system/layers/base
create the directories com/mysql/driver/main
copy the driver library jar Into the folder main
add module.xml
// urn:jboss:module:X.X should be same with the version of wildfly, you can reference other modules.
<module xmlns="urn:jboss:module:1.1" name="com.mysql.driver">
<resources>
<resource-root path="mysql-connector-java-5.1.16.jar" />
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
2. Register the module as driver with CLI.
${WILDFLY_HOME}/bin/standalone.sh (only if wildfly is not running)
./jboss-cli.sh
connect
/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql.driver,driver-class-name=com.mysql.jdbc.Driver)
If the operation is successful then the message below will be showed {"outcome" => "success"}
and into the file of the standalone profile the code below is produced
...
<driver name="mysql" module="com.mysql.driver">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
3. Create database in mysql
login as root: mysql root -p
Create database
create tables
4. Create connection to database from console
http://localhost:9990/console
add datasources with configuration like
name: mysql
JNDI name: java:jboss/mysql
url: jdbc:mysql://localhost:3306/your_database
done.

Categories

Resources