5

I am creating a web application for JBoss EAP 7 and trying to connect to MySQL 8.0 database.

Am getting the error as

[org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 39) WFLYCTL0013: Operation ("add") failed - address: ([("subsystem" => "datasources"), ("jdbc-driver" => "mysql")]) - failure description: "WFLYJCA0041: Failed to load module for driver [com.mysql]"

My module.xml file in \jboss-eap-7.1.0\modules\system\layers\base\com\mysql\main is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-8.0.12" />
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

And placed "mysql-connector-java-8.0.12.jar" in \jboss-eap-7.1.0\modules\system\layers\base\com\mysql\main path where module.xml exist.

Datasource configuraion is:

<datasources>
                <datasource jta="true" jndi-name="java:jboss/datasources/jdbc/sdmspool" pool-name="sdmspool" enabled="true" use-java-context="true">
                    <connection-url>jdbc:sqlserver://database;databaseName = sdms</connection-url>
                    <driver>mysql-connector-java-8.0.12</driver>
                    <security>
                        <user-name>user</user-name>
                        <password>password</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="mysql-connector-java-8.0.12" 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>

Can anyone help me in solving this?

2
  • There is no such thing as Wildfly 7. Wildfly 8 was the first Wildfly release. You're running JBoss 7. I updated the tags. Commented Aug 20, 2018 at 17:34
  • Are there any other errors further up in the logs? Commented Aug 20, 2018 at 21:40

2 Answers 2

8

Try creating the module by using jboss-cli as follows: Run the below commands:

  • ./jboss-cli.sh (this will start cli in disconnected mode,in the same mode run the below command)
  • module add --name=com.mysql --resources=/path/to/mysql.jar --dependencies=javax.api,javax.transaction.api and then try adding respective driver in your eap configuration.

You don't have to explicitly define driver-class and xa-datasource-class.

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

3 Comments

This way worked for me, I was trying to add the Redshift driver, thanks.
Thanks, this configuration I was missing. Worked for me as well
This is the only right way of doing it, official documenation mentioning a method with manual addition of a module is misleading. The command-line function adds to {base-url}\keycloak-11.0.2\modules\com folder directly (not {base-url}\keycloak-11.0.2\modules\system\layers\keycloak\com).
1

resource root path should be as well mysql-connector-java-8.0.12.jar

please note that the extension (.jar) is missing in your xml config

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.