3 Replies Latest reply on Nov 26, 2013 7:11 AM by Wolf-Dieter Fink

    Can't create a MySQL Datasource & driver

    Jean-Noel Colin Newbie

      Hi

       

      I've been trying all day long to setup a working connection to MySQL on JBoss EAP 6.1.

       

      As recommended, I created a module:

      • in /opt/jboss-eap-6.1/modules/com/mysql/main, I copied the mysql-connector-java-5.1.27-bin.jar file
      • in the same directory, I created the following module.txt file

       

      <module xmlns="urn:jboss:module:1.1" name="com.mysql">
        <resources>
          <resource-root path="mysql-connector-java-5.1.27-bin.jar"/>
        </resources>
        <dependencies>
          <module name="javax.api"/>
        </dependencies>
      </module>
      
      

       

      • I have updated the /opt/jboss-eap-6.1/standalone/configuration/standalone.xml file to include both the datasource and the driver
              <subsystem xmlns="urn:jboss:domain:datasources:1.1">
                  <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:/expertsdb" pool-name="expertsdb" enabled="true" use-java-context="true">
                          <connection-url>jdbc:mysql://localhost:3306/expertsdb</connection-url>
                          <driver>com.mysql</driver>
                          <security>
                              <user-name>username</user-name>
                              <password>password</password>
                          </security>
                      </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>
              </subsystem>
      
      

       

      But when I start jboss, I always get the following error:

       

      17:06:44,600 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 25) JBAS014613: Operation ("add") failed - address: ([

          ("subsystem" => "datasources"),

          ("jdbc-driver" => "com.mysql")

      ]) - failure description: "JBAS010441: Failed to load module for driver [com.mysql]"

       

      Could someone please help me achieve this rather simple task?

       

      Thanks a lot

       

      Jean-Noël