2

I'm trying to configure a data source in Wildfly 8.1 with MySQL. I'm on a local environment on windows and I keep getting errors when I start the server. The datasource is registered, but fails when i test it.

enter image description here

I have the mysql connector jar file in C:\wildfly\modules\system\layers\base\com\mysql\main

standalone.xml

<subsystem xmlns="urn:jboss:domain:datasources:2.0">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/MySQLDS" pool-name="MySQLDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:mysql://localhost:3306/bookdb</connection-url>
                    <driver>mysql</driver>
                    <security>
                        <user-name>root</user-name>
                        <password>*******</password>
                    </security>
                    <timeout>  
                        <idle-timeout-minutes>0</idle-timeout-minutes>  
                        <query-timeout>600</query-timeout>  
                    </timeout>                    
                </datasource>
                <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">
                        <driver-class>com.mysql.jdbc.Driver</driver-class>
                        <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

module.xml C:\wildfly\modules\system\layers\base\com\mysql\main

<?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.38-bin.jar"/>              
  </resources>
  <dependencies>
     <module name="javax.api"/>
     <module name="javax.transaction.api"/>
     <module name="javax.servlet.api" optional="true"/>
  </dependencies>
</module>

00:46:17,927 ERROR [org.jboss.as.controller.management-operation](ServerService Thread Pool -- 27) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "datasources"), ("jdbc-driver" => "mysql") ]) - failure description: "JBAS010441: Failed to load module for driver [com.mysql]"

00:46:17,912 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) JBAS010417: Started Driver service with driver-name = h2

00:46:18,171 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017525: Started server default-server.

00:46:18,165 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path C:\wildfly/welcome-content

00:46:18,498 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017531: Host default-host starting

00:46:18,558 INFO [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 4.0.3.Final

00:46:18,694 INFO org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) JBAS015012: Started FileSystemDeploymentService for directory C:\wildfly\standalone\deployments

00:46:18,701 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080

00:46:18,863 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

00:46:19,112 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final

00:46:19,122 ERROR [org.jboss.as.controller.management-operation (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "datasources"), ("data-source" => "MySQLDS") ]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.java:jboss/datasources/MySQLDS is missing [jboss.jdbc-driver.mysql]","jboss.driver-demander.java:jboss/datasources/MySQLDS is missing [jboss.jdbc-driver.mysql]" ]}

00:46:19,155 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "datasources"),("data-source" => "MySQLDS") ]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.java:jboss/datasources/MySQLDS is missing [jboss.jdbc-driver.mysql]","jboss.driver-demander.java:jboss/datasources/MySQLDS is missing [jboss.jdbc-driver.mysql]"],"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {"Services that were unable to start:" => ["jboss.data-source.reference-factory.MySQLDS", "jboss.naming.context.java.jboss.datasources.MySQLDS"], "Services that may be the cause:" => ["jboss.jdbc-driver.mysql"] } }

00:46:19,254 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report JBAS014775: New missing/unsatisfied dependencies: service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.driver-demander.java:jboss/datasources/MySQLDS, service jboss.data-source.java:jboss/datasources/MySQLDS]

00:46:19,616 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management

00:46:19,628 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990

00:46:19,643 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.1.0.Final "Kenny" started (with errors) in 4876ms - Started 185 of 238 services (4 services failed or missing dependencies, 81 services are lazy, passive or on-demand)

00:51:40,780 ERROR [org.jboss.as.controller.management-operation](management-handler-thread - 4) JBAS014613: Operation ("add") failed - address: ([ ("subsystem" => "datasources"), ("jdbc-driver" => "mysql-5-driver") ]) - failure description: "JBAS010441: Failed to load module for driver [mysql]"

00:51:47,961 ERROR [org.jboss.as.controller.management-operation](management-handler-thread - 6) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "datasources"), ("jdbc-driver" => "mysql-5-driver") ]) - failure description: "JBAS010441: Failed to load module for driver [mysql]"

00:53:21,929 ERROR [org.jboss.as.controller.management-operation](management-handler-thread - 8) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "datasources"), ("jdbc-driver" => "mysql-5-driver") ]) - failure description: "JBAS010441: Failed to load module for driver [com.mysql]"

01:01:49,324 ERROR [org.jboss.as.controller.management-operation](XNIO-1 task-7) JBAS014613: Operation ("test-connection-in-pool") failed - address: ([("subsystem" => "datasources"), ("data-source" => "MySQLDS") ]) - failure description: "JBAS010440: failed to invoke operation: JBAS010442: failed to match pool. Check JndiName: java:jboss/datasources/MySQLDS"

Thanks!

1 Answer 1

0

Uploading the MySQL connector .jar file via the browser console as a deployment fixed the issue.

WildFly Console

My data source is working in WildFly 10x, so I don't know if there was an issue with version 8.1.

Here's a decent video on 3 ways to add a data source to Wildfly: https://www.youtube.com/watch?v=xSHXMcRsF0A

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.