I added jdbc driver in pom.xml:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
And I add in project-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
but I run application it throws exception:
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]"
]
}
In Wildfly I has to add driver in standalone.xml but I don't know in wildfly-swarm. In development stage I add a DatasourcesFraction with jdbcDriver, its easy, but when I build .war and I run uberjar java -jar ??????-swarm.jar
throws exception above.
You're actually providing too much information in project-defaults.yml!
swarm:
datasources:
data-sources:
erp-ds:
driver-name: sqlserver
connection-url: jdbc:sqlserver://localhost:1433;DatabaseName=COMPARTILHADO
user-name: teste
password: teste
should be all you need.
By adding com.microsoft.sqlserver:sqljdbc4:4.0 as a project dependency, WF Swarm will automatically create the JDBC Driver configuration for you.
That may not solve the particular issue you're having, so I'd take a look at the WAR that WF Swarm modifies (the one without the .original suffix) in /target and see whether your jdbc jar is inside WEB-INF/lib.