Java lookup(“datasource”)返回org.jboss.jca.adapters.jdbc.WrapperDataSource

Java lookup(“datasource”)返回org.jboss.jca.adapters.jdbc.WrapperDataSource,java,jdbc,jboss,datasource,wildfly,Java,Jdbc,Jboss,Datasource,Wildfly,我正在进行一个项目,该项目需要同时部署在weblogic和jboss上。我从资料来源编译了wildfly。现在,我正在尝试使用命名来获取数据源。应用程序在JBOSS EAP 6.1上运行良好,我能够以javax.sql.datasource的形式获取数据源引用,但现在在widlfly中,使用以下代码 dataSource = (javax.sql.DataSource) context.lookup("datasource"); 它抛出异常 java.lang.ClassCastExcepti

我正在进行一个项目,该项目需要同时部署在weblogicjboss上。我从资料来源编译了wildfly。现在,我正在尝试使用命名来获取数据源。应用程序在JBOSS EAP 6.1上运行良好,我能够以
javax.sql.datasource
的形式获取数据源引用,但现在在widlfly中,使用以下代码

dataSource = (javax.sql.DataSource) context.lookup("datasource");
它抛出异常

java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.WrapperDataSource cannot be cast to javax.sql.DataSource 它不会在使用数据源时抛出上述异常,而是抛出异常

Caused by: java.lang.IncompatibleClassChangeError: Class org.jboss.jca.adapters.jdbc.WrapperDataSource does not implement the requested interface javax.sql.DataSource
我假设这与您在服务器上的数据源中配置JDBC驱动程序的方式有关,或者您在包中提供的另一个驱动程序与您使用的实际驱动程序发生冲突

类似的错误可在以下位置找到:


如果这不起作用,还可以发布遇到问题的服务器的版本。只是为了确保您不会在服务器上遇到固定数据源补丁。

我认为这与您在服务器数据源中配置JDBC驱动程序的方式有关,或者如果您在包中提供的另一个驱动程序与实际使用的驱动程序发生冲突

类似的错误可在以下位置找到:


如果这不起作用,还可以发布遇到问题的服务器的版本。只是为了确保您不会在服务器上遇到固定数据源补丁。

我认为这与您在服务器数据源中配置JDBC驱动程序的方式有关,或者如果您在包中提供的另一个驱动程序与实际使用的驱动程序发生冲突

类似的错误可在以下位置找到:


如果这不起作用,还可以发布遇到问题的服务器的版本。只是为了确保您不会在服务器上遇到固定数据源补丁。

我认为这与您在服务器数据源中配置JDBC驱动程序的方式有关,或者如果您在包中提供的另一个驱动程序与实际使用的驱动程序发生冲突

类似的错误可在以下位置找到:


如果这不起作用,还可以发布遇到问题的服务器的版本。只是为了确保您不会受到服务器上固定数据源补丁的影响。

我在WildFly论坛()上发布了这个问题,发现另一个jar包含
javax.sql.DataSource
接口


我使用一个名为jarscan.jar的实用程序在模块中搜索接口,发现一个jar包含另一个
javax.sql.DataSource
类。删除jar表单模块解决了这个问题。

我在WildFly论坛()上发布了这个问题,发现另一个jar包含
javax.sql.DataSource
接口


我使用一个名为jarscan.jar的实用程序在模块中搜索接口,发现一个jar包含另一个
javax.sql.DataSource
类。删除jar表单模块解决了这个问题。

我在WildFly论坛()上发布了这个问题,发现另一个jar包含
javax.sql.DataSource
接口


我使用一个名为jarscan.jar的实用程序在模块中搜索接口,发现一个jar包含另一个
javax.sql.DataSource
类。删除jar表单模块解决了这个问题。

我在WildFly论坛()上发布了这个问题,发现另一个jar包含
javax.sql.DataSource
接口


我使用一个名为jarscan.jar的实用程序在模块中搜索接口,发现一个jar包含另一个
javax.sql.DataSource
类。删除jar表单模块解决了这个问题。

Hi Flip,感谢您的回复,我已经将DB2驱动程序配置为modules目录下的静态模块。我检查了一下,找不到db2jcc.jar和db2jcc_license_cu.jar的任何其他副本。我已将应用程序部署为EAR,同一应用程序在JBOSS EAP 6.1上运行良好。哪个驱动程序可能与DB2驱动程序冲突?您好,谢谢您的回复,我已经将DB2驱动程序配置为modules目录下的静态模块。我检查了一下,找不到db2jcc.jar和db2jcc_license_cu.jar的任何其他副本。我已将应用程序部署为EAR,同一应用程序在JBOSS EAP 6.1上运行良好。哪个驱动程序可能与DB2驱动程序冲突?您好,谢谢您的回复,我已经将DB2驱动程序配置为modules目录下的静态模块。我检查了一下,找不到db2jcc.jar和db2jcc_license_cu.jar的任何其他副本。我已将应用程序部署为EAR,同一应用程序在JBOSS EAP 6.1上运行良好。哪个驱动程序可能与DB2驱动程序冲突?您好,谢谢您的回复,我已经将DB2驱动程序配置为modules目录下的静态模块。我检查了一下,找不到db2jcc.jar和db2jcc_license_cu.jar的任何其他副本。我已将应用程序部署为EAR,同一应用程序在JBOSS EAP 6.1上运行良好。其他哪个驱动程序可能与DB2驱动程序冲突? Caused by: java.lang.IncompatibleClassChangeError: Class org.jboss.jca.adapters.jdbc.WrapperDataSource does not implement the requested interface javax.sql.DataSource Calling "C:\wildfly-8.0.0.Beta2-SNAPSHOT\bin\standalone.conf.bat" Setting JAVA property to "C:\Progra~2\Java\jdk1.7.0_40\bin\java" =============================================================================== JBoss Bootstrap Environment JBOSS_HOME: "C:\wildfly-8.0.0.Beta2-SNAPSHOT" JAVA: "C:\Progra~2\Java\jdk1.7.0_40\bin\java" =============================================================================== Listening for transport dt_socket at address: 8787 16:04:19,731 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final 16:04:19,903 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.0.Beta2 16:04:19,997 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.0.0.Beta2-SNAPSHOT "WildFly" starting 16:04:21,138 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http) 16:04:21,138 INFO [org.xnio] (MSC service thread 1-1) XNIO version 3.1.0.CR7 16:04:21,153 INFO [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.1.0.CR7 16:04:21,309 INFO [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.0.Beta1 16:04:21,341 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension 16:04:21,356 INFO [org.jboss.as.security] (ServerService Thread Pool -- 46) JBAS013171: Activating Security Subsystem 16:04:21,372 INFO [org.jboss.as.security] (MSC service thread 1-8) JBAS013170: Current PicketBox version=4.0.19.Final 16:04:21,388 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 41) JBAS011800: Activating Naming Subsystem 16:04:21,388 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 33) JBAS010280: Activating Infinispan subsystem. 16:04:21,388 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS017502: Undertow 1.0.0.Beta18 starting 16:04:21,403 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017502: Undertow 1.0.0.Beta18 starting 16:04:21,403 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 39) JBAS012605: Activated the following JSF Implementations: [main] 16:04:21,419 INFO [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.0.Final) 16:04:21,450 INFO [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service 16:04:21,466 INFO [org.jboss.as.mail.extension] (MSC service thread 1-7) JBAS015400: Bound mail session [java:jboss/mail/Default] 16:04:21,466 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) 16:04:21,481 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010417: Started Driver service with driver-name = h2 16:04:21,559 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017527: Creating file handler for path C:\wildfly-8.0.0.Beta2-SNAPSHOT/welcome-content 16:04:21,700 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017525: Started server default-server. 16:04:21,700 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017531: Host default-host starting 16:04:21,763 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017519: Undertow HTTP listener default listening on localhost/127.0.0.1:8080 16:04:21,841 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class com.ibm.db2.jcc.DB2Driver (version 3.57) 16:04:21,841 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) JBAS010417: Started Driver service with driver-name = DB2Driver 16:04:22,091 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) JBAS015012: Started FileSystemDeploymentService for directory C:\wildfly-8.0.0.Beta2-SNAPSHOT\standalone\deployments 16:04:22,091 INFO [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on 127.0.0.1:9999 16:04:22,122 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.1.Final 16:04:22,122 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS] 16:04:22,122 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:/rapiddb] 16:04:22,247 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management 16:04:22,247 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990 16:04:22,247 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.0.0.Beta2-SNAPSHOT "WildFly" started in 2828ms - Started 186 of 223 services (62 services are lazy, passive or on-demand)