我正在为JBoss EAP 7创建一个Web应用程序,并尝试连接到MySQL 8.0
数据库。
我得到的错误是
[org.jboss.as.controller.management-operation](ServerService线程池-39)WFLYCTL0013:操作(“ add”)失败-地址:([(“ subsystem” =>“ datasources”), (“ jdbc-driver” =>“ mysql”)])-故障描述:“ WFLYJCA0041:无法加载驱动程序[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.
数据源配置为:
<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>
有人可以帮助我解决这个问题吗?
答案 0 :(得分:2)
尝试使用jboss-cli创建模块,如下所示:
运行以下命令:
1. ./jboss-cli.sh(这将在断开连接模式下启动cli,在相同模式下运行以下命令)
2。module add --name=com.mysql --resources=/path/to/mysql.jar
--dependencies = javax.api,javax.transaction.api
然后尝试在eap配置中添加相应的驱动程序。您不必显式定义driver-class and xa-datasource-class
。
答案 1 :(得分:0)
资源根路径也应为mysql-connector-java-8.0.12.jar
请注意,您的xml配置中缺少扩展名(.jar)