You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by James Adams <ja...@yahoo.com> on 2007/01/23 06:54:48 UTC

Wrong Connection type returned by ActiveMQConnectionFactory?

I'm running a simple test application in order to figure out how I can
configure Jencks to provide a JTA Transaction Manager for XA transactions
including JDBC and JMS resources.  I am using an embedded ActiveMQ broker
and an in-memory HSQL database.  I am following the examples for Outbound
JMS and Outbound JDBC as shown in the Jencks sample configurations of the
source distribution.  I am using Jencks 2.0, ActiveMQ 4.1.0, ActiveMQ-RA
4.1.0, TranQL 1.4-SNAPSHOT, and TranQL Connector 1.3-SNAPSHOT.

When I run my application I get the following error when I get to the point
in my code where a JMS message is being sent, right after I persist an
object using a DAO which should be enlisted in the same XA transaction.  I
assume that at this point Jencks is creating the first JMS connection
because the error is happening within
ActiveMQConnectionFactory.createConnection() (line 92, "return (Connection)
manager.allocateConnection(factory, info);").  However the Connection
returned from its ConnectionManager (an instance of
org.apache.geronimo.connector.outbound.GenericConnectionManager) is a TranQL
JDBC Connection handle, org.tranql.connector.jdbc.ConnectionHandle, which
implements java.sql.Connection, and it's expecting a javax.jms.Connection
(or at least I think that's what's happening).  Here's the exception stack
trace:

Exception in thread "main" java.lang.ClassCastException:
org.tranql.connector.jdbc.ConnectionHandle
	at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:92)
	at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:66)
	at
org.springframework.jms.core.JmsTemplate.createConnection(JmsTemplate.java:816)
	at
org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:904)
	at
org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:189)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:417)
	at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:477)
	at
org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:558)
	at
org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:549)
	at
com.mycom.jta.producer.MessageSenderImpl.sendMessage(MessageSenderImpl.java:38)
	at
com.mycom.jta.processor.ExampleProcessorImpl.processSuccess(ExampleProcessorImpl.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
	at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
	at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
	at $Proxy10.processSuccess(Unknown Source)
	at
com.mycom.jta.ExampleProcessorJtaTest.main(ExampleProcessorJtaTest.java:25)


Does anyone have a clue as to what is going on and how I can get past this
hurdle?  Thanks in advance for any ideas.


--James
-- 
View this message in context: http://www.nabble.com/Wrong-Connection-type-returned-by-ActiveMQConnectionFactory--tf3062435.html#a8515910
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Wrong Connection type returned by ActiveMQConnectionFactory?

Posted by James Strachan <ja...@gmail.com>.
Great - thanks for letting us know!

On 1/23/07, James Adams <ja...@yahoo.com> wrote:
>
> James thanks for nudging me in the right direction.  It wasn't obvious from
> the documentation -- although it makes perfect sense -- you need to have a
> separate ConnectionManager for JMS and JDBC resources.  Once I made this
> configuration change the below error disappeared.
>
>
> --James
>
>
>
> James.Strachan wrote:
> >
> > I don't understand why org.tranql.connector.jdbc.ConnectionHandle is
> > trying to cast the result of an ActiveMQ connection. Maybe you've made
> > some kind of error in your XML?
> >
> > On 1/23/07, James Adams <ja...@yahoo.com> wrote:
> >>
> >> I'm running a simple test application in order to figure out how I can
> >> configure Jencks to provide a JTA Transaction Manager for XA transactions
> >> including JDBC and JMS resources.  I am using an embedded ActiveMQ broker
> >> and an in-memory HSQL database.  I am following the examples for Outbound
> >> JMS and Outbound JDBC as shown in the Jencks sample configurations of the
> >> source distribution.  I am using Jencks 2.0, ActiveMQ 4.1.0, ActiveMQ-RA
> >> 4.1.0, TranQL 1.4-SNAPSHOT, and TranQL Connector 1.3-SNAPSHOT.
> >>
> >> When I run my application I get the following error when I get to the
> >> point
> >> in my code where a JMS message is being sent, right after I persist an
> >> object using a DAO which should be enlisted in the same XA transaction.
> >> I
> >> assume that at this point Jencks is creating the first JMS connection
> >> because the error is happening within
> >> ActiveMQConnectionFactory.createConnection() (line 92, "return
> >> (Connection)
> >> manager.allocateConnection(factory, info);").  However the Connection
> >> returned from its ConnectionManager (an instance of
> >> org.apache.geronimo.connector.outbound.GenericConnectionManager) is a
> >> TranQL
> >> JDBC Connection handle, org.tranql.connector.jdbc.ConnectionHandle, which
> >> implements java.sql.Connection, and it's expecting a javax.jms.Connection
> >> (or at least I think that's what's happening).  Here's the exception
> >> stack
> >> trace:
> >>
> >> Exception in thread "main" java.lang.ClassCastException:
> >> org.tranql.connector.jdbc.ConnectionHandle
> >>         at
> >> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:92)
> >>         at
> >> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:66)
> >>         at
> >> org.springframework.jms.core.JmsTemplate.createConnection(JmsTemplate.java:816)
> >>         at
> >> org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:904)
> >>         at
> >> org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:189)
> >>         at
> >> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:417)
> >>         at
> >> org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:477)
> >>         at
> >> org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:558)
> >>         at
> >> org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:549)
> >>         at
> >> com.mycom.jta.producer.MessageSenderImpl.sendMessage(MessageSenderImpl.java:38)
> >>         at
> >> com.mycom.jta.processor.ExampleProcessorImpl.processSuccess(ExampleProcessorImpl.java:58)
> >>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> >> Source)
> >>         at java.lang.reflect.Method.invoke(Unknown Source)
> >>         at
> >> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
> >>         at
> >> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
> >>         at
> >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
> >>         at
> >> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
> >>         at
> >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
> >>         at
> >> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
> >>         at $Proxy10.processSuccess(Unknown Source)
> >>         at
> >> com.mycom.jta.ExampleProcessorJtaTest.main(ExampleProcessorJtaTest.java:25)
> >>
> >>
> >> Does anyone have a clue as to what is going on and how I can get past
> >> this
> >> hurdle?  Thanks in advance for any ideas.
> >>
> >>
> >> --James
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Wrong-Connection-type-returned-by-ActiveMQConnectionFactory--tf3062435.html#a8515910
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Wrong-Connection-type-returned-by-ActiveMQConnectionFactory--tf3062435.html#a8516913
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Wrong Connection type returned by ActiveMQConnectionFactory?

Posted by James Adams <ja...@yahoo.com>.
James thanks for nudging me in the right direction.  It wasn't obvious from
the documentation -- although it makes perfect sense -- you need to have a
separate ConnectionManager for JMS and JDBC resources.  Once I made this
configuration change the below error disappeared.  


--James



James.Strachan wrote:
> 
> I don't understand why org.tranql.connector.jdbc.ConnectionHandle is
> trying to cast the result of an ActiveMQ connection. Maybe you've made
> some kind of error in your XML?
> 
> On 1/23/07, James Adams <ja...@yahoo.com> wrote:
>>
>> I'm running a simple test application in order to figure out how I can
>> configure Jencks to provide a JTA Transaction Manager for XA transactions
>> including JDBC and JMS resources.  I am using an embedded ActiveMQ broker
>> and an in-memory HSQL database.  I am following the examples for Outbound
>> JMS and Outbound JDBC as shown in the Jencks sample configurations of the
>> source distribution.  I am using Jencks 2.0, ActiveMQ 4.1.0, ActiveMQ-RA
>> 4.1.0, TranQL 1.4-SNAPSHOT, and TranQL Connector 1.3-SNAPSHOT.
>>
>> When I run my application I get the following error when I get to the
>> point
>> in my code where a JMS message is being sent, right after I persist an
>> object using a DAO which should be enlisted in the same XA transaction. 
>> I
>> assume that at this point Jencks is creating the first JMS connection
>> because the error is happening within
>> ActiveMQConnectionFactory.createConnection() (line 92, "return
>> (Connection)
>> manager.allocateConnection(factory, info);").  However the Connection
>> returned from its ConnectionManager (an instance of
>> org.apache.geronimo.connector.outbound.GenericConnectionManager) is a
>> TranQL
>> JDBC Connection handle, org.tranql.connector.jdbc.ConnectionHandle, which
>> implements java.sql.Connection, and it's expecting a javax.jms.Connection
>> (or at least I think that's what's happening).  Here's the exception
>> stack
>> trace:
>>
>> Exception in thread "main" java.lang.ClassCastException:
>> org.tranql.connector.jdbc.ConnectionHandle
>>         at
>> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:92)
>>         at
>> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:66)
>>         at
>> org.springframework.jms.core.JmsTemplate.createConnection(JmsTemplate.java:816)
>>         at
>> org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:904)
>>         at
>> org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:189)
>>         at
>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:417)
>>         at
>> org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:477)
>>         at
>> org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:558)
>>         at
>> org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:549)
>>         at
>> com.mycom.jta.producer.MessageSenderImpl.sendMessage(MessageSenderImpl.java:38)
>>         at
>> com.mycom.jta.processor.ExampleProcessorImpl.processSuccess(ExampleProcessorImpl.java:58)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>> Source)
>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>         at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
>>         at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
>>         at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
>>         at
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
>>         at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
>>         at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
>>         at $Proxy10.processSuccess(Unknown Source)
>>         at
>> com.mycom.jta.ExampleProcessorJtaTest.main(ExampleProcessorJtaTest.java:25)
>>
>>
>> Does anyone have a clue as to what is going on and how I can get past
>> this
>> hurdle?  Thanks in advance for any ideas.
>>
>>
>> --James
>> --
>> View this message in context:
>> http://www.nabble.com/Wrong-Connection-type-returned-by-ActiveMQConnectionFactory--tf3062435.html#a8515910
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Wrong-Connection-type-returned-by-ActiveMQConnectionFactory--tf3062435.html#a8516913
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Wrong Connection type returned by ActiveMQConnectionFactory?

Posted by James Strachan <ja...@gmail.com>.
I don't understand why org.tranql.connector.jdbc.ConnectionHandle is
trying to cast the result of an ActiveMQ connection. Maybe you've made
some kind of error in your XML?

On 1/23/07, James Adams <ja...@yahoo.com> wrote:
>
> I'm running a simple test application in order to figure out how I can
> configure Jencks to provide a JTA Transaction Manager for XA transactions
> including JDBC and JMS resources.  I am using an embedded ActiveMQ broker
> and an in-memory HSQL database.  I am following the examples for Outbound
> JMS and Outbound JDBC as shown in the Jencks sample configurations of the
> source distribution.  I am using Jencks 2.0, ActiveMQ 4.1.0, ActiveMQ-RA
> 4.1.0, TranQL 1.4-SNAPSHOT, and TranQL Connector 1.3-SNAPSHOT.
>
> When I run my application I get the following error when I get to the point
> in my code where a JMS message is being sent, right after I persist an
> object using a DAO which should be enlisted in the same XA transaction.  I
> assume that at this point Jencks is creating the first JMS connection
> because the error is happening within
> ActiveMQConnectionFactory.createConnection() (line 92, "return (Connection)
> manager.allocateConnection(factory, info);").  However the Connection
> returned from its ConnectionManager (an instance of
> org.apache.geronimo.connector.outbound.GenericConnectionManager) is a TranQL
> JDBC Connection handle, org.tranql.connector.jdbc.ConnectionHandle, which
> implements java.sql.Connection, and it's expecting a javax.jms.Connection
> (or at least I think that's what's happening).  Here's the exception stack
> trace:
>
> Exception in thread "main" java.lang.ClassCastException:
> org.tranql.connector.jdbc.ConnectionHandle
>         at
> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:92)
>         at
> org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:66)
>         at
> org.springframework.jms.core.JmsTemplate.createConnection(JmsTemplate.java:816)
>         at
> org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:904)
>         at
> org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:189)
>         at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:417)
>         at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:477)
>         at
> org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:558)
>         at
> org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:549)
>         at
> com.mycom.jta.producer.MessageSenderImpl.sendMessage(MessageSenderImpl.java:38)
>         at
> com.mycom.jta.processor.ExampleProcessorImpl.processSuccess(ExampleProcessorImpl.java:58)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
>         at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
>         at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
>         at $Proxy10.processSuccess(Unknown Source)
>         at
> com.mycom.jta.ExampleProcessorJtaTest.main(ExampleProcessorJtaTest.java:25)
>
>
> Does anyone have a clue as to what is going on and how I can get past this
> hurdle?  Thanks in advance for any ideas.
>
>
> --James
> --
> View this message in context: http://www.nabble.com/Wrong-Connection-type-returned-by-ActiveMQConnectionFactory--tf3062435.html#a8515910
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/