0
我添加JDBC驅動程序的pom.xml:如何在.war包裝中添加服務模塊在wildfly-swarm中?
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
我加入項目defaults.yml:
swarm:
datasources:
data-sources:
erp-ds:
driver-name: sqlserver
connection-url: jdbc:sqlserver://localhost:1433;DatabaseName=COMPARTILHADO
user-name: teste
password: teste
jdbc-drivers:
sqlserver:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
xa-datasource-name: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
driver-module-name: com.microsoft.sqlserver
但我運行的應用程序,它拋出異常:
2017-06-14 13:09:54,337 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "erp-ds")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.sqlserver"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.driver-demander.java:jboss/datasources/erp-ds is missing [jboss.jdbc-driver.sqlserver]",
"org.wildfly.data-source.erp-ds is missing [jboss.jdbc-driver.sqlserver]"
]
}
在Wildfly中,我必須在standalone.xml中添加驅動程序,但我不知道在wildfly-swarm中。在開發階段,我使用jdbcDriver添加了一個DatasourcesFraction,這很容易,但是當我構建.war時,我運行uberjar java -jar ??????-swarm.jar
會拋出上面的異常。
謝謝。我重新構建了我的pom.xml文件,並且在這裏簡化了很多東西,並且工作。 – Igor