OschtärEi OschtärEi - 1 month ago 11
Java Question

Can't add mysql driver to jboss

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):

error from managment console

Answer

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...

<?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.26-bin.jar"/>              
  </resources>
  <dependencies>
     <module name="javax.api"/>
  </dependencies>
</module>
Comments