我通常在standalone.xml上市一樣(只是一個樣本)我的數據源指定它:使用本地數據源,而不是在standalone.xml(WildFly)
<datasource jta="false" jndi-name="java:jboss/datasources/myDB" pool-name="myDB" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://mysql/myDB</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>password</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
MySQL驅動程序安裝到WildFly。我知道,一個可以添加數據源到webapp --> WEB-INF --> my-ds.xml
但是當我部署我buildet戰WildFly我得到
16:59:15,121 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "poc")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.mysql"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.data-source.\"jboss.naming.context.java.jboss.datasources.testDB\" is missing [jboss.jdbc-driver.mysql]"]
}
16:59:15,124 ERROR [org.jboss.as.server] (management-handler-thread - 3) WFLYSRV0021: Deploy of deployment "poc.war" was rolled back with the following failure message:
{
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.mysql"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.data-source.\"jboss.naming.context.java.jboss.datasources.testDB\" is missing [jboss.jdbc-driver.mysql]"]
}
我的問題是:
我如何才能將我的數據源定義從standalone.xml到我的項目,並使其部署到WildFly時工作
你是如何安裝mysql驅動程序的? –
它作爲一個模塊安裝,我已經解決了這個問題 – x4k3p
你有嗎? WildFly配置中驅動程序的名稱是什麼?請運行jboss-cli.sh並將'ls subsystem = datasources'的輸出添加到您的問題中,因爲您似乎沒有名爲'mysql'的驅動程序。 –