I am transferring my database from MySQL to MariaDB.
The data transfer process is now complete. However, I have a problem with connecting the driver to WildFly.
After WildFly startup, I get an error:
2019-12-22 09:47:18,985 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 43) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "mariadb")
]) - failure description: "WFLYJCA0115: Module for driver [org.mariadb] or one of it dependencies is missing: [org.mariadb]"
I am looking for the solution but nothing works.
My module.xml
:
<module xmlns="urn:jboss:module:1.5" name="org.mariadb">
<resources>
<resource-root path="mariadb-java-client-2.5.2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
and standalone.xml
:
<datasources>
<datasource jndi-name="java:jboss/MariaDBDS" pool-name="MariaDBDS" enabled="true" statistics-enabled="true">
<connection-url>jdbc:mariadb://localhost:3306/bgdb</connection-url>
<driver>mariadb</driver>
<new-connection-sql>SELECT 1</new-connection-sql>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="mariadb" module="org.mariadb">
<xa-datasource-class>org.mariadb.jdbc.MariaDbDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
The <datasource>...</datasource>
was added from one of the solution from web.
Here is my directory structure:
modules
└─ system
└─ layers
└─ base
└─ com
└─ mariadb
└─ main
├─ mariadb-java-client-2.5.2.jar
└─ module.xml
I found the problem and solution.
The configuration files module.xml
and mariadb-java-client-2.5.2.jar
was in /modules/system/layers/base/com/mariadb/main
.
But the java package of mariadb-java-client-2.5.2.jar
is org.mariadb
. So the files have to be in corresponds direcotry /modules/system/layers/base/org/mariadb/main
.
After this change everything works properly.
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.