简体   繁体   中英

JMS Connection problems in Tomcat

I'm trying to port an old,large, Weblogic-based application to Tomcat. The application uses Spring, EclipseLink, and an Oracle database.

There are two different database connections, both almost identical. The connectivity to the JSF pages work fine. Unfortunately the one to the JMS (Oracle AQ) doesn't. 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}. Cause: Error creating the db_connection; 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.

Specifically, bear in mind that the Oracle AQ connection factory needs the native Oracle connection object. However, the app server most likely wraps the dataSource connection 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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