activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <marc...@absa.co.za>
Subject Transaction problems with ActiveMQ under WebSphere v5.1
Date Thu, 22 Dec 2005 08:17:14 GMT
Hello,
 
There appears to be a transaction problem with the when using ActiveMQ
as a Generic JMS Provider under WebSphere v5.1 with durable
subscriptions. This problem only manifests itself when using a message
driven bean.
 
The symptom of the problem is that the last message retrieved from a
topic is never acknowledged. 
 
The situation is as follows:  
 
I have a broker started with one pending message in the queue for the
message driven bean. When I start websphere I see the message driven
bean process the message and try to commit the transaction by calling
commit on the TransactionContext (See stack dump below.) Unfortunately
the transaction ID is null at this point since the
TransactionContext.start() method has never been invoked.
 
05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R java.lang.Exception:
Stack trace
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
java.lang.Thread.dumpStack(Thread.java:1097)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
org.activemq.TransactionContext.commit(TransactionContext.java:220)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
org.activemq.ActiveMQSession.commit(ActiveMQSession.java:400)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
org.activemq.ActiveMQTopicSession.commit(ActiveMQTopicSession.java:77)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.jms.JMSManagedSession$JMSLocalTransaction.commit(JMSManagedS
ession.java:1121)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.j2c.LocalTransactionWrapper.commit(LocalTransactionWrapper.j
ava:227)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.Transaction.JTA.OnePhaseResourceImpl.commit_one_phase(OnePhas
eResourceImpl.java:128)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.Transaction.JTA.RegisteredResources.flowCommitOnePhase(Regist
eredResources.java:1624)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.Transaction.JTA.RegisteredResources.distributePrepare(Registe
redResources.java:743)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.Transaction.JTA.TransactionImpl.internalPrepare(TransactionIm
pl.java:1278)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java:9
71)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java:1
50)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java:177
)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:712)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:167)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl
.java:565)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3038)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:102)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:127)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:177)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
org.activemq.ActiveMQSession.deliver(ActiveMQSession.java:569)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
org.activemq.ActiveMQSession.run(ActiveMQSession.java:551)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
org.activemq.ActiveMQTopicSession.run(ActiveMQTopicSession.java:339)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:924)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(Serve
rSession.java:740)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:375)
[05/12/22 09:40:24:855 CAT] 35d7ef9f SystemErr R at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)

ActiveMQ then attempts to send a ACK message and as part of the
"afterMessageDelivered" code path which starts a new transaction (See
stack trace below).

[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R
java.lang.Exception: Stack trace
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
java.lang.Thread.dumpStack(Thread.java:1097)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
org.activemq.TransactionContext.begin(TransactionContext.java:157)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
org.activemq.ActiveMQSession.doStartTransaction(ActiveMQSession.java:148
6)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
org.activemq.ActiveMQSession.afterMessageDelivered(ActiveMQSession.java:
1148)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
org.activemq.ActiveMQSession.deliver(ActiveMQSession.java:570)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
org.activemq.ActiveMQSession.run(ActiveMQSession.java:551)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
org.activemq.ActiveMQTopicSession.run(ActiveMQTopicSession.java:339)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:924)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(Serve
rSession.java:740)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:375)
[05/12/22 09:40:24:865 CAT] 35d7ef9f SystemErr     R 	at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)

No commit is ever sent by the ActiveMQ client if this is the only
message in the queue. This means that the ACK is never completely
processed by the broker.

If another message is published to the topic then while processing the
new message the transaction setup as part of the ACK is committed.

I am still unsure how to solve this problem. If I don't use a MDB and
instead lookup the topic using JNDI then it works perfectly. This
appears to be because the ActiveMQSession object is not transactional
i.e. ActiveMQSession.isTransacted() returns false.

Regards,

Marcus


___________________________________________________________

Important Notice:
Authorised Financial Services Provider

Important restrictions, qualifications and disclaimers 
("the Disclaimer") apply to this email. To read this click on the 
following address or copy into your Internet browser: 

http://www.absa.co.za/disclaimer

The Disclaimer forms part of the content of this email in terms of 
section 11 of the Electronic Communications and Transactions 
Act, 25 of 2002. 

If you are unable to access the Disclaimer, send a blank e-mail 
to disclaimer@absa.co.za and we will send you a copy of the 
Disclaimer.

Mime
View raw message