简体   繁体   中英

JBoss Wildfly 9, JNDI exception

I am new to JBoss Wildfly. I have used JBoss 7.1.1 and it was working fine with the same Database with same changes. I have changed standalone.xml file to connect to the Server Database in wildfly JBoss. But whenever I tried to run standalone.bat file it is giving following error:

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

Have placed mysql-connector-java-5.1.36-bin.jar under modules->com->mysql->main

The module.xml file is:

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

The datasource in standalone.xml is as follows:

<datasource jta="true" jndi-name="java:/MySqlDS" pool-name="MySqlDS_Pool" enabled="true" use-java-context="true" use-ccm="true">
                <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
                <driver-class>com.mysql.jdbc.Driver</driver-class>
                <driver>com.mysql</driver>
                <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                <pool>
                    <min-pool-size>10</min-pool-size>
                    <max-pool-size>100</max-pool-size>
                    <prefill>true</prefill>
                </pool>
                <security>
                    <user-name>root</user-name>
                    <password>root</password>
                </security>
                <statement>
                    <prepared-statement-cache-size>32</prepared-statement-cache-size>
                    <share-prepared-statements>true</share-prepared-statements>
                </statement>
            </datasource>
            <drivers>
                <driver name="com.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>

Please help. Thanks in advance.

You don't say what version of WildFly you are using. It looks like it isn't finding the module at all.

In WildFly 8+ you need to put it in the directory /modules/system/layers/base/com/mysql/main/module.xml

Is this where you have it?

I had a similar issue, there is a problem with the latest mysql jdbc driver has reported here

To workaround the issue you should specify the driver class in your standalone.xml:

<datasource
...
<driver-class>com.mysql.jdbc.Driver</driver-class>
...
</datasource>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM