Starburst
Starburst

Reputation: 33

Unable to instantiate driver class "com.microsoft.sqlserver.jdbc.SQLServerDataSource" - Failure deploying sqljdbc4.jar in Wildfly 10

I have big issues using sqljdbc4.jar in Wildfly 10. When I start the server I get the following issue:

Unable to instantiate driver class "com.microsoft.sqlserver.jdbc.SQLServerDataSource" 

... and several exceptions ...

08:32:12,570 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.subunit."PPJAS.ear"."WebService.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."PPJAS.ear"."WebService.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "WebService.war" of deployment "PPJAS.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

What I did till now:

Creating a Folder for the .jar with the .jar itsself and the module.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- JDBC Drivers module.xml file to configure your JDBC drivers-->

<!-- SQL Server 2008 example -->
<module xmlns="urn:jboss:module:1.3" name="com.microsoft.sqlserver">
  <resources>
    <resource-root path="sqljdbc4.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

.. at C:\Program Files\Wildfly\wildfly-10.0.0.Final\modules\com\microsoft\sqlserver\main

Added the datasource and the driver in the standalone.xml

<datasource jndi-name="java:jboss/datasources/DBName" pool-name="DBPoolName">
                    <connection-url>jdbc:microsoft:sqlserver://IP:Port;DatabaseName=DBName</connection-url>
                    <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDataSource</driver-class>
                    <driver>sqlserver</driver>
                    <security>
                        <user-name>username</user-name>
                        <password>password</password>
                    </security>
                    <validation>
                        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
                    </validation>
                </datasource>

<driver name="sqlserver" module="com.microsoft.sqlserver">
                        <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDataSource</driver-class>
                    </driver>

I (might??) did the same procedure with the MySQL Driver without any problems. I also tried to add the datasource via the web interface wildfly management but the system also cannot find the specific driver.

Does anyone have any ideas?

Thanks for your time!

Upvotes: 2

Views: 3078

Answers (2)

vedat
vedat

Reputation: 1309

make sure you are using 'modules\system\layers\base\com\microsoft\jdbc\main' folder

Upvotes: 0

aduenas
aduenas

Reputation: 1

I had the same problem and the correct configuration is: standalone.xml

<driver name="sqlserver" module="com.microsoft.sqlserver">
    <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
    <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
</driver>

module.xml

<module xmlns="urn:jboss:module:1.1" name="com.microsoft.sqlserver">
  <resources>
     <resource-root path="mssql-jdbc-6.2.2.jre8.jar"/>
  </resources>
  <dependencies>
      <module name="javax.api"/>
      <module name="javax.transaction.api"/>
  </dependencies>
</module>

Software tested: JbossEAP 7.2 JDK version: 8 SQL Server JDBC Driver version: mssql-jdbc-6.2.2.jre8.jar

Portion of the log:

14:02:49,587 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 41) WFLYJCA0004: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 6.2) 14:02:49,589 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: Started Driver service with driver-name = sqlserver

Regards.

Upvotes: 0

Related Questions