JBoss 7 MySQL datasource issue

21,493

Solution 1

This will help you to fix the problem.

Jboss and mysql connector

Solution 2

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

Solution 3

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.

Share:
21,493
nobody
Author by

nobody

Updated on August 27, 2020

Comments

  • nobody
    nobody over 3 years

    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.

  • Sven
    Sven over 10 years
    Yes, this was exactly what I had to do to make it work. I used the 5.0.8 jar and it worked fine, an upgrade to 5.1.x failed so i rollbacked to 5.0.8 and up we go.