dataSource = (javax.sql.DataSource) context.lookup("datasource");
它引发异常
java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.WrapperDataSource cannot be cast to javax.sql.DataSource
如果我尝试使用以下代码,
Object obj = context.lookup("datasource");
dataSource = (javax.sql.DataSource) obj;
它不会抛出上面的异常,而是在使用数据源时抛出异常
Caused by: java.lang.IncompatibleClassChangeError: Class org.jboss.jca.adapters.jdbc.WrapperDataSource does not implement the requested interface javax.sql.DataSource
但是,查看类的代码,我们可以看到它实现了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)
我认为这可能与您在服务器上的数据源中配置JDBC驱动程序的方式有关,或者与您使用的实际驱动程序发生冲突的包中提供的另一个驱动程序有关。
在https://community.jboss.org/message/250795可以找到类似的错误
如果没有成功,还可以发布遇到问题的服务器版本。只是为了确保您不会遭受服务器上的固定数据源补丁。
问题内容: 我有两个模型,用户模型和时间表,我想用$ lookup 和猫鼬把这两个模型结合起来。 用户(型号) 时间表(型号) 现在我的查询使用猫鼬: 用户汇总 我的查询结果是一个空的array(),如下所示: 查询结果: 我不知道为什么,但是查询结果是一个 空数组 ,我试图使用$ unwind和$ match,但也无法正常工作。 编辑: 用户集合 时间表的收集 问题答案: 猫鼬在创建时将集合名称
1. Tomcat JDBC DBCP作为老牌DataSource一统江湖很久,也很久没有更新了。但Tomcat JDBC 最近出来把它替换掉了,理由详见Tomcat JDBC的自述,简单来说你又慢,又复杂。 所幸Tomcat JDBC完全兼容DBCP的旧属性,只要把spring配置文件里的class 名改掉就可以继续用了。 <bean id="dataSource" class="org
new LSGlobe.DataSource() 定义数据源的接口,可将任意数据转换为EntityCollection供使用。 此对象是用于文档目的的接口,不能直接实例化。 See: Entity DataSourceDisplay Members changedEvent : Event 获取基础数据更改时引发的事件。 clock : DataSourceClock 获取此数据源的首选时钟设置。
分布式数据源(common-datasource) 继承 spring 框架中的 AbstractDatasource 的实现类。兼容spring 框架中的datasourceUtil 类,datasourceUtil 类的作用是管理 spring 事务。只要 java 中的各个 orm 框架兼容spring,分布式数据源(common-datasource)就支持。通过配置文件 xml 插拔模式
问题内容: 例如我有一个功能: 我怎样才能返回AJAX后得到的? 问题答案: 因为请求是异步的,所以您无法返回ajax请求的结果(而同步ajax请求是一个 糟糕的 主意)。 最好的选择是将自己的回调传递给f1 然后,您将像这样致电:
当Windows系统崩溃或是出现错误时,往往会给出错误代码,这些代码一般是供专业人员或开发者进行分析使用的。Windows Error Lookup Tool提供了一个简单的方法,只需在软件界面中输入错误代码,它会自动显示这个错误代码的含义或类型等详细信息。