BTM With Apache Camel

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

BTM With Apache Camel

greenbean
BTM With Apache Camel

I am integrating BTM in to a project that contains uses ActiveMQ 5.4.0, Camel 2.4.0, Spring 3.0.3, BTM 2.0.1 among other items.  The integration worked fine for code that predated Camel usage and used a DefaultMessageListenerContainer directly with XA.  However, when attempting to integrated with Camel routers (in the same container running the non-camel code) that consume from/send to ActiveMQ queues in XA transactions using the ActiveMQComponent, I get the errors like the one shown below.

Do you have any idea why this is occurring?  Attached is logging from a single thread that produces the error directly shown below.  This provides context around the error.


2010-11-24 17:39:56,710 WARN  [org.springframework.jms.listener.DefaultMessageListenerContainer] (myThreadPoolExecutor-0) Setup of JMS message listener invoker failed for destination 'myQueue' - trying to recover. Cause: null

java.lang.NullPointerException

        at bitronix.tm.internal.XAResourceHolderState.start(XAResourceHolderState.java:192)

        at bitronix.tm.internal.XAResourceManager.enlist(XAResourceManager.java:89)

        at bitronix.tm.BitronixTransaction.enlistResource(BitronixTransaction.java:74)

        at bitronix.tm.resource.common.TransactionContextHelper.enlistInCurrentTransaction(TransactionContextHelper.java:51)

        at bitronix.tm.resource.jms.MessageConsumerWrapper.enlistResource(MessageConsumerWrapper.java:42)

        at bitronix.tm.resource.jms.MessageConsumerWrapper.receive(MessageConsumerWrapper.java:63)

        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:405)

        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:308)

        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)

        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056)

        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:952)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

        at java.lang.Thread.run(Thread.java:619)

<<threadlog.txt>>

Kevin Urciolo
Northrop Grumman Information Systems
703-803-4931

571-249-8761 (cell)


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

    http://xircles.codehaus.org/manage_email

threadlog.txt (42K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: BTM With Apache Camel

Ludovic Orban
Administrator
This looks like the DefaultMessageListenerContainer is trying to read a message from a closed session but I'm surprised by this behavior as there are checks in BTM which are supposed to catch this kind of error and I know Spring's DefaultMessageListenerContainer is relatively well coded.

Would it be possible for you to post a simple maven project reproducing the problem? That would help me a lot figuring out which component is doing something wrong. It could be BTM but it could be Spring as well. If BTM is at fault I'll fix the bug, if it's Spring I'll figure out what setting is confusing BTM and make it throw an appropriate exception with an understandable error message.

Thanks,
Ludovic
Reply | Threaded
Open this post in threaded view
|

Re: BTM With Apache Camel

jkuchta
I have experienced the same problem when I set DMLC cacheLevel to CACHE_CONSUMER. In that case consumer is cached by DMLC , i.e. it is not obtained from BTM JMS session wrapper (except for the first time) and thus it is not included in a currently running transaction.

The problem was solved by setting the cache level to CACHE_SESSION which I believe is the correct setting. In that case the BTM session wrapper is cached by DMLC while the consumer is cached in the BTM session wrapper only. DMLC has to always ask BTM session wrapper for a consumer when it needs one thus the consumer gets included in a current transaction.

DMLC=org.springframework.jms.listener .DefaultMessageListenerContainer
Reply | Threaded
Open this post in threaded view
|

Re: BTM With Apache Camel

Ludovic Orban-2
That's one way to work around the problem (thanks for it) but it turned out there is a real problem in the BTM JMS pool: https://jira.codehaus.org/browse/BTM-99

Apparently not all emails of that discussion ended up on the mailing list.


2011/3/8 jkuchta <[hidden email]>

I have experienced the same problem when I set DMLC cacheLevel to
CACHE_CONSUMER. In that case consumer is cached by DMLC , i.e. it is not
obtained from BTM JMS session wrapper (except for the first time) and thus
it is not included in a currently running transaction.

The problem was solved by setting the cache level to CACHE_SESSION which I
believe is the correct setting. In that case the BTM session wrapper is
cached by DMLC while the consumer is cached in the BTM session wrapper only.
DMLC has to always ask BTM session wrapper for a consumer when it needs one
thus the consumer gets included in a current transaction.

DMLC=org.springframework.jms.listener .DefaultMessageListenerContainer

--
View this message in context: http://old.nabble.com/BTM-With-Apache-Camel-tp30299743p31095983.html
Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.


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

   http://xircles.codehaus.org/manage_email