wildfly10 配置mysql,如何在Wildfly 10上设置MariaDB JNDI?

I'm trying to move my Tomcat web service to Wildfly 10. I thought it should be drag and drop into Wildfly's deployment folder and everything should be fine, but it seems not like that.

This is my MariaDB datasource definition in standalone.xml:

jdbc:mariadb://db_ip/db_name

mariadb

dbAcc

dbPassword

true

false

org.mariadb.jdbc.Driver

org.mariadb.jdbc.MariaDbDataSource

then I put mariadb-java-client-1.4.6.jar and my WAR file into wildfly/standalone/deployments, start the Wildfly, and error messages came into my eyes:

07:05:21,137 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 60) WFLYUT0021: Registered web context: /MySV

07:05:21,143 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([

("subsystem" => "datasources"),

("data-source" => "MariaDBDS")

]) - failure description: {

"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.mariadb"],

"WFLYCTL0180: Services with missing/unavailable dependencies" => [

"jboss.driver-demander.java:jboss/MariaDBDS is missing [jboss.jdbc-driver.mariadb]",

"org.wildfly.data-source.MariaDBDS is missing [jboss.jdbc-driver.mariadb]"

]

}

07:05:21,148 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([

("subsystem" => "datasources"),

("data-source" => "MariaDBDS")

]) - failure description: {

"WFLYCTL0412: Required services that are not installed:" => [

"jboss.jdbc-driver.mariadb",

"jboss.jdbc-driver.mariadb"

],

"WFLYCTL0180: Services with missing/unavailable dependencies" => [

"jboss.driver-demander.java:jboss/MariaDBDS is missing [jboss.jdbc-driver.mariadb]",

"org.wildfly.data-source.MariaDBDS is missing [jboss.jdbc-driver.mariadb]",

"org.wildfly.data-source.MariaDBDS is missing [jboss.jdbc-driver.mariadb]"

]

}

I cannot let my service connect to DB, do I missed any step?

解决方案

If I look at your configuration, you setup the driver to be a module. So you create it as a module in your server rather than deploying it as a separate jar in the deployments folder.

If you want to setup a datasource where the driver is in the deployments folder, you do something like this:

jdbc:mariadb://db_ip/db_name

mariadb-java-client-1.4.6.jar

org.mariadb.jdbc.Driver

dbAcc

dbPassword

true

false

No separate driver declaration needed, its all contained within the datasource configuration.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值