3 Replies Latest reply on Apr 17, 2014 4:46 AM by jaikiran

    Wildfly 8.0 will not load Module for MySQL Driver

    akevinbailey

      I get the following error when I add the MySQL JDBC driver as a Wildfly module:

       

      22:34:10,030 INFO  [org.jboss.as.naming] (MSC service thread 1-12) JBAS011802: Starting Naming Service

      22:34:10,032 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 28) JBAS014613: Operation ("add") failed - address: ([

          ("subsystem" => "datasources"),

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

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

       

      I am running Windows 8.1 and and my Wildfly home directory is C:\Java\wildfly-8.0.0.Final.  I created the directory C:\Java\wildfly-8.0.0.Final\modules\com\mysql\jdbc\main and placed the module.xml and mysql-connector-java-5.1.30-bin.jar files in this directory.

       

      My module.xml is:

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- Custom MySQL module --AKB-- -->
      <module xmlns="urn:jboss:module:1.1" name="com.mysql.jdbc">
          <resources>
              <resource-root path="mysql-connector-java-5.1.30-bin.jar"/>
              <!-- Insert resources here -->
          </resources>
          <dependencies>
              <module name="javax.api"/>
              <module name="javax.transaction.api"/>
          </dependencies>
      </module>
      

       

      and the datasources subsystem portion of my standalone.xml is

      <subsystem xmlns="urn:jboss:domain:datasources:2.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;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                  <driver>h2</driver>
                  <security>
                      <user-name>sa</user-name>
                      <password>sa</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.jdbc">
                      <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                  </driver>
              </drivers>
          </datasources>
      </subsystem>
      

       

      I can't figure out what I am doing wrong.  Is there something I am missing?  According to the documentation this should work.

       

      Any assistance is greatly appreciated.

        • 1. Re: Wildfly 8.0 will not load Module for MySQL Driver
          jaikiran

          Are you sure there isn't any typo in the directory name(s) where the module is placed?

          • 2. Re: Wildfly 8.0 will not load Module for MySQL Driver
            akevinbailey

            I found the issue it is the "--AKB--" in the module.xml.  Remove the "--" and it works, kind of.  Now I am getting a new error:

             

            01:28:41,802 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)

            01:28:41,806 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-11) JBAS010417: Started Driver service with driver-name = mysql

            01:28:41,808 INFO  [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 4.0.0.Final

            01:28:41,808 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)

            01:28:41,810 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 28) JBAS014612: Operation ("add") failed - address: ([

                ("subsystem" => "datasources"),

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

            ]): org.jboss.msc.service.DuplicateServiceException: Service jboss.jdbc-driver.mysql is already registered

                    at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

                    at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:235) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

                    at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:767) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

                    at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

                    at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2401) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

                    at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

                    at org.jboss.as.controller.OperationContextImpl$ContextServiceBuilder.install(OperationContextImpl.java:1418) [wildfly-controller-8.0.0.Final.jar:8.0.0.Final]

                    at org.jboss.as.connector.subsystems.datasources.JdbcDriverAdd.startDriverServices(JdbcDriverAdd.java:160)

                    at org.jboss.as.connector.subsystems.datasources.JdbcDriverAdd.performRuntime(JdbcDriverAdd.java:118)

                    at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:75) [wildfly-controller-8.0.0.Final.jar:8.0.0.Final]

                    at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:591) [wildfly-controller-8.0.0.Final.jar:8.0.0.Final]

                    at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:469) [wildfly-controller-8.0.0.Final.jar:8.0.0.Final]

                    at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:273) [wildfly-controller-8.0.0.Final.jar:8.0.0.Final]

                    at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:268) [wildfly-controller-8.0.0.Final.jar:8.0.0.Final]

                    at org.jboss.as.controller.ParallelBootOperationStepHandler$ParallelBootTask.run(ParallelBootOperationStepHandler.java:343) [wildfly-controller-8.0.0.Final.jar:8.0.0.Final]

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]

                    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

                    at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]

             

             

            At least now it is finding it.  Looks  like I will need to hack the mysql-connector-java-5.1.30-bin.jar and remove the reference to com.mysql.fabric.jdbc.FabricMySQLDriver.

            • 3. Re: Wildfly 8.0 will not load Module for MySQL Driver
              jaikiran
              org.jboss.msc.service.DuplicateServiceException: Service jboss.jdbc-driver.mysql is already registered

              That's a bug [WFLY-3218] Module for MySQL JDBC driver with version 5.1.30+ needs <driver-class> in standalone.xml - JBoss Issue Track… which has been fixed in the recently released 8.1.0.CR1 Downloads · WildFly

              1 of 1 people found this helpful