I'm learning Jencks and trying to set up a simple JMS in -> JDBC save -> JMS
out mechanism and enclose it all in one XA transaction. i.e. I pull a
TextMessage off a queue, save the text to a database, and send a new message
to another queue. I'm making pretty good progress, but I've encountered an
odd-seeming problem. I'm getting this exception when I try to do the "JMS
out" part:

java.lang.ClassCastException: org.tranql.connector.jdbc.ConnectionHandle
cannot be cast to javax.jms.Connection
        at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:94)
        at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67)
        at
org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
        at 
org.springframework.jms.core.JmsTemplate.access$500(JmsTemplate.java:90)
        at
org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:1030)
        at
org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:280)
        at 
org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:458)
        at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539)
        at rds.jencks.ListenerBean.onMessage(ListenerBean.java:69)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy0.onMessage(Unknown Source)
        at org.jencks.XAEndpoint.onMessage(XAEndpoint.java:129)
        at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:116)
        at
org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:59)
        at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:727)
        at 
org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
        at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:290)
        at
org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)

Tracing through the Geronimo code that Jencks is using, I see that when the
org.apache.activemq.ra.ActiveMQConnectionFactory calls
connectionManager.allocateConnection()--that's line 94, where the exception
occurs--it makes its way down to a
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor that
seems to cache connections by transaction. This interceptor returns a
previously-cached *JDBC* connection that was associated with the same
transaction. That obviously won't work for a JMS producer.

I assume this is happening because I'm using the same connection manager
object for both JMS and JDBC resources. I assumed this was the right thing
to do because of how JCA is set up. Am I supposed to create a separate
connection manager for each resource adapter/connection factory, or have I
failed to configure something else properly?
-- 
View this message in context: 
http://www.nabble.com/One-or-many-connection-managers--tp18642884p18642884.html
Sent from the jencks - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to