简体   繁体   English

无法实例化驱动程序类“ com.microsoft.sqlserver.jdbc.SQLServerDataSource”-在Wildfly 10中部署sqljdbc4.jar失败

[英]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.

相关问题 如何关闭 com.microsoft.sqlserver.jdbc.SQLServerDataSource - How to close com.microsoft.sqlserver.jdbc.SQLServerDataSource 缺少工件 com.microsoft.sqlserver:sqljdbc4:jar:4.0 - Missing artifact com.microsoft.sqlserver:sqljdbc4:jar:4.0 使用sqljdbc4.jar从Eclipse到MSSQL服务器的JDBC连接 - JDBC connection from Eclipse to MSSQL server using sqljdbc4.jar 无法在Wildfly 10中实例化驱动程序SQLServerDriver - Unable to instantiate driver SQLServerDriver in Wildfly 10 无法使用 Jmeter 创建类“com.microsoft.sqlserver.jdbc.SQLServerDriver”的 JDBC 驱动程序 - Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' using Jmeter java.lang.IllegalStateException:无法加载驱动程序类:com.microsoft.sqlserver.jdbc.SQLServerDriver - java.lang.IllegalStateException: Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver 在Maven POM中使用的Proguard 5.0无法正确处理-libraryjars(Microsoft sqljdbc4.jar) - Proguard 5.0 used in maven POM does not process the -libraryjars correctly (Microsoft sqljdbc4.jar) java.lang.ClassNotFoundException:无法在新的 docker 容器上加载 class:com.microsoft.sqlserver.jdbc.SQLServerDriver - java.lang.ClassNotFoundException: Unable to load class: com.microsoft.sqlserver.jdbc.SQLServerDriver on new docker container 无法通过sqljdbc4.jar获取Java中的Prepared-和CallableStatement的SQL执行计划 - Unable to obtain SQL execution plan in Java for Prepared- and CallableStatement with sqljdbc4.jar 我是否需要sqljdbc4.jar的64位版本 - Do I require a 64-bit version of sqljdbc4.jar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM