[英]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: 在Wildfly 10中使用sqljdbc4.jar时遇到大问题。启动服务器时,出现以下问题:
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: 使用本身的.jar和module.xml为.jar创建文件夹:
<?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 ..在C:\\ Program Files \\ Wildfly \\ wildfly-10.0.0.Final \\ modules \\ com \\ microsoft \\ sqlserver \\ main
Added the datasource and the driver in the standalone.xml 在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. 我(可能??)使用MySQL驱动程序执行了相同的步骤,没有任何问题。 I also tried to add the datasource via the web interface wildfly management but the system also cannot find the specific driver.
我还尝试通过Web界面wildfly管理添加数据源,但是系统也找不到特定的驱动程序。
Does anyone have any ideas? 有人有什么想法吗?
Thanks for your time! 谢谢你的时间!
I had the same problem and the correct configuration is: standalone.xml 我遇到了同样的问题,正确的配置是: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.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 经过测试的软件:JbossEAP 7.2 JDK版本:8 SQL Server JDBC驱动程序版本: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. 问候。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.