Wildfly 9 does not load MySQL driver at startup

I am creating a web application for WildFly that will connect to a MySQL database through JPA (Hibernate). At the moment, I'm just trying to start WildFly and load the MySQL driver offline. I use this page as a guide: http://wildfly.org/news/2014/02/06/GlassFish-to-WildFly-migration/

I run WildFly and MySQL locally on a Windows system:

  • Windows 7 Enterprise SP1
  • Oracle Java SE 1.8.0_45
  • WildFly 9.0.0.Final
  • MySQL Server 5.6

Attempts to use the recommended console commands failed, so I manually edited the WildFly configuration files to look like the examples on the page above. First, I created a module directory and placed the MySQL JAR file and module.xml file in it:

    Directory of C:\wildfly-9.0.0.Final\modules\system\layers\base\com\mysql\main

07/06/2015  09:54 AM    <DIR>          .
07/06/2015  09:54 AM    <DIR>          ..
07/06/2015  10:12 AM               334 module.xml
07/01/2015  02:38 PM           968,668 mysql-connector-java-5.1.35.jar

Maven, Maven :

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.35</version>
</dependency>

module.xml , , wildfly.org:

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

, datasources standalone.xml:

        <datasource jndi-name="java:/MySQLDS" pool-name="MyDS" enabled="true" use-java-context="true">
            <connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
            <driver>mysql</driver>
            <security>
                <user-name>root</user-name>
                <password>secret</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>
            </driver>
        </drivers>

WildFly , % WILDFLY_HOME%\bin\standalone.bat, , % WILDFLY_HOME%\standalone\logs\server.log:

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

, Qaru /, , . , , Java SE 7 WildFly 8.2 . .

+4
6

: .. /com/mysql/main

wildlfy, , .

+4

module.xml . JAR, module.xml, JAR \system\layers\base\com\mysql\main.

+2

. WordPress module.xml, ( ):

<resource-root path="postgresql-9.4.1211.jar"/>

... Wildfly ( ):

<resource-root path="postgresql-9.4.1211.jar"/>
+2

main, module.xml jar .

JBOSS_HOME\modules\system\layers\base\com\mysql\module.xml

, (module.xml jar )

JBOSS_HOME\modules\system\layers\base\com\mysql\main\module.xml
+1

, , . wildfly (localhost: 9990/console). , , DS , , standalone.xml. , , .

0

.

<module>
...
</module>

there is a mysterious space in my module.xml that is not utf-8 or english, which leads to my crash. After I deleted the blank or changed it to English. Everything is fine. In addition, I was looking for some solutions to this problem. Most of them can be summarized with the module.xml file problem. A typo of the name or encoding of the contents. Hope he is stalking others.

-1
source

All Articles