简体   繁体   English

Tomcat 中的 JMS 连接问题

[英]JMS Connection problems in Tomcat

I'm trying to port an old,large, Weblogic-based application to Tomcat.我正在尝试将一个旧的、大型的、基于 Weblogic 的应用程序移植到 Tomcat。 The application uses Spring, EclipseLink, and an Oracle database.该应用程序使用 Spring、EclipseLink 和 Oracle 数据库。

There are two different database connections, both almost identical.有两个不同的数据库连接,两者几乎相同。 The connectivity to the JSF pages work fine.与 JSF 页面的连接工作正常。 Unfortunately the one to the JMS (Oracle AQ) doesn't.不幸的是,JMS (Oracle AQ) 没有。 Here's the error I'm getting:这是我得到的错误:

myapp |我的应用程序 | 17:17:34,177 ERROR XmlMessageListenerContainer.refreshConnectionUntilSuccessful Could not refresh JMS Connection for destination 'SPFR_EVENT_Q' - retrying using FixedBackOff{interval=5000, currentAttempts=4, maxAttempts=unlimited}. 17:17:34,177 错误 XmlMessageListenerContainer.refreshConnectionUntilSuccessful 无法刷新目标“SPFR_EVENT_Q”的 JMS 连接 - 使用 FixedBackOff{interval=5000,currentAttempts=4,maxAttempts=unlimited} 重试。 Cause: Error creating the db_connection;原因:创建 db_connection 时出错; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy51 cannot be cast to oracle.jdbc.internal.OracleConnection nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy51 cannot be cast to oracle.jdbc.internal.OracleConnection

Here is the relevant connection:这是相关的连接:

<Resource
   name="jdbc/myAQDS"
   auth="Container"
   type="javax.sql.DataSource"
   factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
   driverClassName="oracle.jdbc.OracleDriver"
   url="jdbc:oracle:thin:theurlhere"
   username="theuser"
   password="thepassword"
   maxTotal="150"
   maxIdle="10"
 />

Any ideas what's causing this?任何想法是什么原因造成的? I googled for the specific error, and came up completely empty handed.我用谷歌搜索了具体的错误,结果完全空手而归。

Have a look at the Spring documentation here: https://docs.spring.io/spring-data/jdbc/old-docs/2.0.0.M1/reference/html/orcl.streamsaq.html Specifically the section about the NativeJdbcExtractor as there's an OracleJdbc4NativeJdbcExtractor available. Have a look at the Spring documentation here: https://docs.spring.io/spring-data/jdbc/old-docs/2.0.0.M1/reference/html/orcl.streamsaq.html Specifically the section about the NativeJdbcExtractor因为有一个 OracleJdbc4NativeJdbcExtractor 可用。

Specifically, bear in mind that the Oracle AQ connection factory needs the native Oracle connection object.具体来说,请记住 Oracle AQ 连接工厂需要原生 Oracle 连接 object。 However, the app server most likely wraps the dataSource connection object.但是,应用服务器很可能包装了数据源连接 object。 Therefore, try using the OracleJdbc4NativeJdbcExtractor as the nativeJdbcExtractor of your JMS connection factory, which will be used to unwrap the connection and keep the Oracle library happy.因此,请尝试使用 OracleJdbc4NativeJdbcExtractor 作为 JMS 连接工厂的 nativeJdbcExtractor,它将用于解包连接并保持 Oracle 库满意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM