Ok this is driving me crazy. Especially because there are already many similar questions out there. But no answer works for me.
I have jboss 7.1.1 on my windows 7 machine (running it from eclipse normally) and want to use mysql.
I did the following:
1 created directory jboss-as-7.1.1.Final\modules\com\mysql\main
2 Files there: module.xml
and mysql-connector-java-5.1.26-bin.jar
(downloaded from official mysql site)
3 Content of module.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<modulexmlns="urn:jboss:module:1.0" name="com.mysql">
<resourxces>
<resource-rootpath="mysql-connector-java-5.1.26-bin.jar"/>
</resources>
<dependencies>
<modulename="javax.api"/>
</dependencies>
</module>
4 Relevant parts from jboss-as-7.1.1.Final\standalone\configuration\standalone.xml
:
<datasource jndi-name="java:jboss/datasources/mysqlDS" pool-name="mysqlDS" enabled="true" jta="true" use-ccm="true" use-java-context="true">
<connection-url>jdbc:mysql://192.168.1.1:3306/eAuftrag</connection-url>
<driver>com.mysql</driver>
<security>
<user-name>root</user-name>
<password>fffff</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>
and:
<driver name="com.mysql" module="com.mysql" />
Everytime I start the jboss server I see this message:
service jboss.jdbc-driver.com_mysql (missing) dependents: [service jboss.data-source.java:jboss/datasources/mysqlDS]
And when I go to the managment-console and look at datasources, the mysqlDS is listed there, but when I click on it I get the error (sorry can't select the text there, so here comes the image):
You need to give the driver tag a driver class or a data source.
Make sure you do NOT have a space at the beginning of
module.xml
file or you will get a:...error for this driver.
To make the JDBC driver classes available to the JBoss Application Server, copy the archive mysql-mysql-connector-java-5.1.5-bin.jar from the Connector/J distribution to the lib directory in the default server configuration (assuming that is the server configuration you’re running).
Now create a mysql-ds.xml
you can also refer this links https://zorq.net/b/2011/07/12/adding-a-mysql-datasource-to-jboss-as-7
http://docs.jboss.org/jbossas/getting_started/v4/html/db.html
WILDFLY 10 using mysql 5.7
follow this steps: comment or delete exampleds in standalone.xml
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
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:
and ready, JAVA_HOME should be ok
Here is my sample module.xml
Below is the Data source configuration in standalone.xml
Look at the driver tag in above. drive is just
mysql
and not thecom.mysql
. Hope this should help you....So once more I can pay tribute to my stupidity. I did everything right except I had typos in my
module.xml
file. Notice that in the code above are no blanks (" ") between some words - somehow they got lost. But what's even worse is that apparantly these module-files are not validated by jboss, that's why I never realized it. Anyway here's the correct config without the typos...