activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rkrol <r.k...@free.fr>
Subject Re: MDB Transaction problem
Date Thu, 26 Oct 2006 12:16:08 GMT

Ok you didn't test ActiveMQ with JOnAS before. But I think my experimentation
could be a good feedback for you.

I work for an important firm in Telecommunication which is deciding what JMS
Provider to prescribe.
But the prescribed WAS are JOnAS, Weblogic and WebSphere, and we try to
choose for a product that works with all WAS, not only WebLogic.

I continued my research to find the differences between the two executions
(1 message / n messages). 
I traced JOTM and ActiveMQ DEBUG logs. 

1 message in the queue (OK) :
EXIT - Event OnMessage()
2006-10-26 12:08:22,965 : TransactionImpl.delistResource :
TransactionImpl.delistResource
2006-10-26 12:08:22,965 : TransactionImpl.delistResource : xares=
org.apache.activemq.ra.LocalAndXATransaction@3fa57e, flag= 67108864
2006-10-26 12:08:22,965 : SubCoordinator.getXaresIndex : getXaresIndex
xares= org.apache.activemq.ra.LocalAndXATransaction@3fa57e
2006-10-26 12:08:22,965 : SubCoordinator.getXaresIndex : resourceList.size=
1
2006-10-26 12:08:22,965 : SubCoordinator.getXaresIndex : search xares with
same obj ref
2006-10-26 12:08:22,965 : SubCoordinator.getXaresIndex : res=
org.apache.activemq.ra.LocalAndXATransaction@3fa57e
2006-10-26 12:08:22,965 : SubCoordinator.getXaresIndex : xaresIndex= 0
2006-10-26 12:08:22,965 : XidImpl.<init> : old XID=
bb14:38:0:01d3846c829252ff31...051c02:
2006-10-26 12:08:22,981 : XidImpl.<init> : index= 0
2006-10-26 12:08:22,981 : SubCoordinator.getXaresIndex : getXaresIndex
xares= org.apache.activemq.ra.LocalAndXATransaction@3fa57e
2006-10-26 12:08:22,981 : SubCoordinator.getXaresIndex : resourceList.size=
1
2006-10-26 12:08:22,981 : SubCoordinator.getXaresIndex : search xares with
same obj ref
2006-10-26 12:08:22,981 : SubCoordinator.getXaresIndex : res=
org.apache.activemq.ra.LocalAndXATransaction@3fa57e
2006-10-26 12:08:22,981 : SubCoordinator.getXaresIndex : xaresIndex= 0
2006-10-26 12:08:22,981 : TransactionImpl.delistResource : resXid=
bb14:38:40:01d3846c829252ff31...051c02:01d3846c829252ff3180c...000000
2006-10-26 12:08:22,981 : TransactionImpl.delistResource : delisted with
resource= org.apache.activemq.ra.LocalAndXATransaction@3fa57e
2006-10-26 12:08:22,981 : TransactionImpl.delistResource : end myjavaxxid=
bb14:38:40:01d3846c829252ff31...051c02:01d3846c829252ff3180c...000000
2006-10-26 12:08:22,981 : TransactionContext.end : End:
bb14:38:40:01d3846c829252ff31...051c02:01d3846c829252ff3180c...000000
2006-10-26 12:08:22,981 : TransactionContext.setXid : Ended XA transaction:
XID:47892:01d3846c829252ff3180c8b5c5ca9785da2020202020202020202020202020202020202020202020202020202020000000043a105e051c02:01d3846c829252ff3180c8b5c5ca9785da2020202020202020202020202020202020202020202020202020202020000000000000000000000000000000000000
2006-10-26 12:08:22,981 : TransactionImpl.delistResource :
enlistedXAres.remove xares=
org.apache.activemq.ra.LocalAndXATransaction@3fa57e
2006-10-26 12:08:22,996 : Current.getTransaction : threadTx.get=
java.lang.ThreadLocal@329eab
2006-10-26 12:08:22,996 : Current.getTransaction : Transaction ret=
bb14:38:0:01d3846c829252ff31...051c02:
2006-10-26 12:08:22,996 : Current.getStatus : Current.getStatus()
2006-10-26 12:08:22,996 : Current.getTransaction : threadTx.get=
java.lang.ThreadLocal@329eab
2006-10-26 12:08:22,996 : Current.getTransaction : Transaction ret=
bb14:38:0:01d3846c829252ff31...051c02:
2006-10-26 12:08:22,996 : TransactionImpl.getStatus :
TransactionImpl.getStatus()
2006-10-26 12:08:22,996 : SubCoordinator.getStatus : status=STATUS_ACTIVE
2006-10-26 12:08:22,996 : Current.commit : commit transaction


n messages in the queue (KO) :
EXIT - Event OnMessage()
2006-10-26 12:04:51,730 : TransactionImpl.delistResource :
TransactionImpl.delistResource
2006-10-26 12:04:51,745 : TransactionImpl.delistResource : xares=
org.apache.activemq.ra.LocalAndXATransaction@43af93, flag= 67108864
2006-10-26 12:04:51,745 : SubCoordinator.getXaresIndex : getXaresIndex
xares= org.apache.activemq.ra.LocalAndXATransaction@43af93
2006-10-26 12:04:51,745 : SubCoordinator.getXaresIndex : resourceList.size=
1
2006-10-26 12:04:51,745 : SubCoordinator.getXaresIndex : search xares with
same obj ref
2006-10-26 12:04:51,745 : SubCoordinator.getXaresIndex : res=
org.apache.activemq.ra.LocalAndXATransaction@43af93
2006-10-26 12:04:51,761 : SubCoordinator.getXaresIndex : xaresIndex= 0
2006-10-26 12:04:51,761 : XidImpl.<init> : old XID=
bb14:38:0:011aa55903fc022d0c...1d280b:
2006-10-26 12:04:51,761 : XidImpl.<init> : index= 0
2006-10-26 12:04:51,761 : SubCoordinator.getXaresIndex : getXaresIndex
xares= org.apache.activemq.ra.LocalAndXATransaction@43af93
2006-10-26 12:04:51,761 : SubCoordinator.getXaresIndex : resourceList.size=
1
2006-10-26 12:04:51,761 : SubCoordinator.getXaresIndex : search xares with
same obj ref
2006-10-26 12:04:51,777 : SubCoordinator.getXaresIndex : res=
org.apache.activemq.ra.LocalAndXATransaction@43af93
2006-10-26 12:04:51,777 : SubCoordinator.getXaresIndex : xaresIndex= 0
2006-10-26 12:04:51,777 : TransactionImpl.delistResource : resXid=
bb14:38:40:011aa55903fc022d0c...1d280b:011aa55903fc022d0cd6e...000000
2006-10-26 12:04:51,777 : TransactionImpl.delistResource : delisted with
resource= org.apache.activemq.ra.LocalAndXATransaction@43af93
2006-10-26 12:04:51,777 : TransactionImpl.delistResource : end myjavaxxid=
bb14:38:40:011aa55903fc022d0c...1d280b:011aa55903fc022d0cd6e...000000
2006-10-26 12:04:51,777 : TransactionContext.end : End:
bb14:38:40:011aa55903fc022d0c...1d280b:011aa55903fc022d0cd6e...000000
2006-10-26 12:36:46,667 : TransactionImpl.timeoutExpired :
TransactionImpl.timeoutExpired
2006-10-26 12:36:46,667 : Current.getCurrent : Current.getCurrent unique=
org.objectweb.jotm.Current@329ec2
2006-10-26 12:36:46,667 : TransactionImpl.timeoutExpired : set rollback only
(tx=bb14:38:0:01d3846c829252ff31...57ac05:)
2006-10-26 12:36:46,667 : SubCoordinator.setRollbackOnly :
status=STATUS_ACTIVE


So we can see that the problem appear in the
org.apache.activemq.TransactionContext class.
The end() method begin, we have the trace to prove it
("TransactionContext.end : End: bb14:38:40:011aa55903fc022d0c......").
So we don't know what method cause the end of the execution, without
exception...


Details of the end() method :
public void end(Xid xid, int flags) throws XAException {
	if(log.isDebugEnabled())
		log.debug("End: " + xid);
	if(isInLocalTransaction())
		throw new XAException(-6);
	if((flags & 0x22000000) != 0) {
		if(!equals(associatedXid, xid))
			throw new XAException(-6);
		try {
			beforeEnd();
		}
		catch(JMSException e) {
			throw toXAException(e);
		}
		setXid(null);
	} else if((flags & 0x4000000) == 0x4000000) {
		if(equals(associatedXid, xid)) {
			try {
				beforeEnd();
			} 
			catch(JMSException e) {
				throw toXAException(e);
			}
			setXid(null);
		}
	} else {
		throw new XAException(-5);
	}
}

But what we know is that the log of setXid(), that is like
"TransactionContext.setXid : Ended XA transaction...." is not traced.

Details of the setXid() method :
private void setXid(Xid xid) throws XAException {
	if(xid != null) {
		associatedXid = xid;
		transactionId = new XATransactionId(xid);
		TransactionInfo info = new TransactionInfo(connectionId, transactionId,
(byte)0);
		try {
			connection.asyncSendPacket(info);
			if(log.isDebugEnabled())
				log.debug("Started XA transaction: " + transactionId);
		} 
		catch(JMSException e) {
			throw toXAException(e);
		}
	} else {
		if(transactionId != null) {
			TransactionInfo info = new TransactionInfo(connectionId, transactionId,
(byte)7);
			try {
				connection.syncSendPacket(info);
				if(log.isDebugEnabled())
					log.debug("Ended XA transaction: " + transactionId);
			}	
			catch(JMSException e) {
				throw toXAException(e);
			}
			ArrayList l = (ArrayList)endedXATransactionContexts.get(transactionId);
			if(l == null) {
				l = new ArrayList(3);
				endedXATransactionContexts.put(transactionId, l);
				l.add(this);
			} 
			else if(!l.contains(this))
				l.add(this);
		}
	associatedXid = null;
	transactionId = null;
	}
}


So the problem should be in "beforeEnd()" method or
"connection.asyncSendPacket(info)"...

Any other idea to help me ?





James.Strachan wrote:
> 
> FWIW I don't know of anyone testing the ActiveMQ RA on JOnAS so there
> could be some issue there. Things work in Geronimo and WebLogic at
> least.
> 
> You can specify multiple configurations on the URI using the normal
> URI query notation ?foo=bar&whatnot=xyz etc
> 
> 
> On 10/20/06, rkrol <r.krol@free.fr> wrote:
>>
>> So anybody can help me ?
>> Is there any way to see the acknowledgement/transaction operations ?
>> How can I resolve my problem ?
>>
>> Is it possible to define 2 flags in the Server URL specified in the
>> ra.xml ?
>> I've tried these solutions without success :
>> <config-property-value>tcp://localhost:61616?jms.optimiseAcknowledge=false&jms.prefetchPolicy.queuePrefetch=1</config-property-value>
>> <config-property-value>tcp://localhost:61616?jms.optimiseAcknowledge=false,jms.prefetchPolicy.queuePrefetch=1</config-property-value>
>>
>> I'm studying on the different open source MOM to replace MQ Series.
>> ActiveMQ seems to be very interesting, but because of this problem, I
>> think
>> we are going to choose an other product...
>>
>> For the last chance, I will test the MDP with Spring... hope it works.
>>
>>
>> Rudy
>>
>>
>> rkrol wrote:
>> >
>> > Hi,
>> >
>> > I have some problems with my MDB that I want to use to transfer
>> messages
>> > from queue "question" to queue "reponse".
>> >
>> > The MDB works fine if there is only one message on the queue "question"
>> :
>> >  - the message is received
>> >  - a message is sent on "reponse"
>> >  - transaction is commited
>> >
>> > The problem appears when the queue "question" contains more than one
>> > message :
>> >  - the first message is received
>> >  - the message on "reponse" is sent
>> >  - transaction is not committed, and goes on time-out
>> >              => first message is still in queue "question"
>> >              => the next messages are not treated
>> >
>> > Here is my configuration :
>> >  - ActiveMQ 4.1 SNAPSHOT executed in standalone mode
>> >  - a Ressource Adapter deployed on JOnAS 4.6.6
>> >  - a MDB deployed on the same JOnAS that use the JNDI names specified
>> in
>> > the RA for ActiveMQ ConnexionFactory and Queues
>> >  - the configuration files :
>> >                * http://www.nabble.com/file/3748/activemq.xml
>> activemq.xml
>> >                * http://www.nabble.com/file/3749/jonas-ejb-jar.xml
>> > jonas-ejb-jar.xml
>> >                * http://www.nabble.com/file/3750/ejb-jar.xml
>> ejb-jar.xml
>> >                * http://www.nabble.com/file/3751/jonas-ra.xml
>> jonas-ra.xml
>> >                * http://www.nabble.com/file/3753/ra.xml ra.xml
>> >  - the MDB code :  http://www.nabble.com/file/3756/MyMDBBean.java
>> > MyMDBBean.java
>> >
>> >
>> > I think the problem concerns the ActiveMQ configuration about the
>> > acknowledge management, because the same code works with JORAM...
>> > I've tried to
>> >  - disable the optimizeAcknowledge in the URL property of the "ra.xml"
>> > (ex:
>> >
>> <config-property-value>tcp://localhost:61616?jms.optimizeAcknowledge=false</config-property-value>)
>> >  - configure the prefetch size to 1 in the URL property of the "ra.xml"
>> > (ex:
>> >
>> <config-property-value>tcp://localhost:61616?jms.prefetchPolicy.all=1</config-property-value>)
>> >  - add the autoAcknowledge mode in ActivationSpec that is, I think, the
>> > default mode
>> > but these solutions don't resolve the problem...
>> >
>> > Thanks in advance for any help.
>> >
>> > Rudy
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/MDB-Transaction-problem-tf2473372.html#a6920707
>> 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/MDB-Transaction-problem-tf2473372.html#a7009967
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message