activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <marc...@absa.co.za>
Subject RE: Transaction problems with ActiveMQ under WebSphere v5.1
Date Fri, 23 Dec 2005 07:57:55 GMT
Hi,

I was trying  to use the 3.2.2 branch from svn. I have also had a look
at the v4 branch and I see that it works very differently from v3. I am
attempting to get the v4 branch working but am having problems with the
ActiveMQConnectionConsumer::dispatch() method since it seems that the
session is of the wrong type i.e. ActiveMQTopicSession instead of
ActiveMQSession. There is code in v3 to handle this (shown below) but no
matching code exists for v4.


        ServerSession serverSession = sessionPool.getServerSession();
        Session nestedSession = serverSession.getSession();
        ActiveMQSession session = null;
        if (nestedSession instanceof ActiveMQSession) {
            session = (ActiveMQSession) nestedSession;
        } else if (nestedSession instanceof ActiveMQTopicSession) {
            ActiveMQTopicSession topicSession = (ActiveMQTopicSession)
nestedSession;
            session = (ActiveMQSession) topicSession.getNext();
        } else if (nestedSession instanceof ActiveMQQueueSession) {
            ActiveMQQueueSession queueSession = (ActiveMQQueueSession)
nestedSession;
            session = (ActiveMQSession) queueSession.getNext();
        } else {
            throw new JMSException("Invalid instance of session obtained
from server session." +
            "The instance should be one of the following:
ActiveMQSession, ActiveMQTopicSession, ActiveMQQueueSession. " +
            "Found instance of " + nestedSession.getClass().getName());
        }
        session.dispatch(message);
        serverSession.start();


Regards,

Marcus

-----Original Message-----
From: Hiram Chirino [mailto:hiram@hiramchirino.com] 
Sent: 22 December 2005 04:45 PM
To: activemq-dev@geronimo.apache.org
Subject: Re: Transaction problems with ActiveMQ under WebSphere v5.1

Hi.  What version of ActiveMQ are you using?

Regards,
Hiram

On Dec 22, 2005, at 3:17 AM, <marcusp@absa.co.za> <marcusp@absa.co.za>
wrote:

> 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.


___________________________________________________________

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