将MySql添加到JBoss 8.1(Wildfly) [英] Adding MySql to JBoss 8.1 (Wildfly)
问题描述
所以我遵循了本教程: https://zorq.net/b/2011/07/12/adding-a-mysql-datasource-to-jboss-as-7/
So I have followed this tutorial: https://zorq.net/b/2011/07/12/adding-a-mysql-datasource-to-jboss-as-7/
我已经按照本教程中的描述完成了所有工作;但是我在启动时总是遇到此错误:
I have done everything as described in the tutorial; yet I keep getting this error on start up:
14:42:19,442 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "ExpensesDataSourcePool")
]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.data-source.java:/ExpensesDataSource is missing [jboss.jdbc-driver.mysql]",
"jboss.driver-demander.java:/ExpensesDataSource is missing [jboss.jdbc-driver.mysql]"
]}
14:42:19,450 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "ExpensesDataSourcePool")
]) - failure description: {
"JBAS014771: Services with missing/unavailable dependencies" => [
"jboss.data-source.java:/ExpensesDataSource is missing [jboss.jdbc-driver.mysql]",
"jboss.driver-demander.java:/ExpensesDataSource is missing [jboss.jdbc-driver.mysql]"
],
"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
"Services that were unable to start:" => [
"jboss.data-source.reference-factory.ExpensesDataSourcePool",
"jboss.naming.context.java.ExpensesDataSource"
],
"Services that may be the cause:" => ["jboss.jdbc-driver.mysql"]
}
}
14:42:19,489 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "mysql-connector-java-5.1.34.jar" (runtime-name : "mysql-connector-java-5.1.34.jar")
14:42:19,491 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.data-source.java:/ExpensesDataSource, service jboss.driver-demander.java:/ExpensesDataSource]
这是我的模块目录在Jboss文件夹中的结构:modules/com/mysql/main
,带有两个文件module.xml
和mysql-connector-java-5.1.34.jar
This is the structure of my modules dir in the Jboss folder: modules/com/mysql/main
with two files module.xml
and mysql-connector-java-5.1.34.jar
这是我的module.xml文件:
This is my module.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.34.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
我还在standalone/deployments
这是我的standalone.xml
下的standalone.xml
<datasource jndi-name="java:/ExpensesDataSource" pool-name="ExpensesDataSourcePool" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/expenses</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
</datasource>
<driver name="mysql" module="com.mysql"/>
推荐答案
我发现了我的错误,我不得不将module.xml和jar放在系统模块下,而不是创建一个新的com文件夹
I found my error, I had to put my module.xml and jar under system modules instead of creating a new com folder
这篇关于将MySql添加到JBoss 8.1(Wildfly)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!