I am running my application on a WildFly 10 server. I do not wish to place my connection details on my application src codes thus am trying to place it inside WildFly 10 server itself.
However I am facing issues.
Under [WILDFLY_HOME]\modules\system\layers\base\com\microsoft
,
I created the following directory sqlserver\main
and I place my JAR file and my XML file inside the main folder.
The JAR that I am using is sqljdbc.jar
.
module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- JDBC Drivers module.xml file to configure your JDBC drivers-->
<!-- SQL Server 2014 example -->
<module xmlns="urn:jboss:module:1.3" name="com.microsoft.sqlserver">
<resources>
<resource-root path="sqljdbc.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Next under [WILDFLY_HOME]\standalone\configuration
, I modified the standalone.xml
. Under the subsystem datasource section, I add the details for SQL Server.
standalone.xml:
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:/TestDS" pool-name="TestDS" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://localhost\test:1433;databaseName=test</connection-url>
<driver>mssql</driver>
<security>
<user-name>sa</user-name>
<password>Password123!</password>
</security>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>50</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"></valid-connection-checker>
</validation>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mssql" module="com.microsoft.sqlserver">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
The error that I am facing now is as per below when I start running my WildFly:
15:19:51,098 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "TestDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.jdbc-driver.mssql",
"jboss.jdbc-driver.mssql"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.TestDS is missing [jboss.jdbc-driver.mssql]",
"jboss.driver-demander.java:/TestDS is missing [jboss.jdbc-driver.mssql]",
"org.wildfly.data-source.TestDS is missing [jboss.jdbc-driver.mssql]"
]
}
15:19:51,120 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mssql (missing) dependents: [service org.wildfly.data-source.TestDS, service jboss.driver-demander.java:/TestDS]