ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » MQSeries Issue/ Generic RA for JMS

Post new topic  Reply to topic Goto page 1, 2, 3  Next
 MQSeries Issue/ Generic RA for JMS « View previous topic :: View next topic » 
Author Message
binod
PostPosted: Fri Aug 05, 2005 7:49 am    Post subject: MQSeries Issue/ Generic RA for JMS Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

Hi ,

I am working to integrate Generic RA for JMS (http://genericjmsra.dev.java.net) with Websphere MQ. I am on a red hat linux machine and is usng Webshepere MQ 5.3. Following is the problem I am facing. Any help is appreciated.

I configured the resource adapter (RA) to use WMQ and deployed an MDB to receive messages from a Queue usins the RA. The MDB then post a reply to a reply queue. The MDB uses a container managed transaction and thus need to do a 2PC.

Following is the sequence of operations.

1. RA passes the XAResource object to JTA transacton manager for inbound message
2. JTS TM calls XAResource.start on the XAResource object
3. RA deliver the message to the MDB from the session object corresponding to the XAResource. onMessage kicks in...
4. MDB creates an outbound RA connection and sesssion to send message to reply Queue. RA connection/sesson uses a wrapped MQ JMS connecton/session internally
5. JTA TM obtains the XAResource object of outbound session.
6. JTA TM does a isSameRM on the first (inbound) XAResource with the second XAResource object
7. MQ JMS XAResource object returns true, since both of them uses the same Queue Manager.
8. Since isSameRM is true, JTA TM decides to call start() on the second XAResource object using the same xid object (with same branch qualifer).

/// Up to this every thng seems fine.

9. second XAResource.start() hangs!!!!

My questions.
1. Why does isSameRM returns true?
2. If it was supposed to be true and if WMQ can somehow manage work on both connections, why should XAResource.start hang?

What am I missing?
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Aug 05, 2005 9:24 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

What CSD of MQ?
Forgive my ignorance but what is the App Server where you deployed the MDB? Is it WAS
Back to top
View user's profile Send private message Send e-mail Visit poster's website
binod
PostPosted: Fri Aug 05, 2005 10:04 am    Post subject: Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

I am very new to Websphere MQ. I googled and found out how to get CSD.

My mqver says the following. It look I am on CSD10.

Name: WebSphere MQ
Version: 530.10 CSD10
CMVC level: p530-10-L050504
BuildType: IKAP - (Production)

Currently I am using J2EE 1.4 reference implementation. But the RA is JCA 1.5 complant, so, it should not matter.
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Aug 05, 2005 10:20 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

binod wrote:

Currently I am using J2EE 1.4 reference implementation.

I don't know what it means, if somebody else understands please jumpin
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Fri Aug 05, 2005 10:26 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

vennela wrote:
binod wrote:

Currently I am using J2EE 1.4 reference implementation.

I don't know what it means, if somebody else understands please jumpin


I think he means http://java.sun.com/j2ee/1.4/download.html#sdk
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
binod
PostPosted: Fri Aug 05, 2005 10:27 am    Post subject: Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

jefflowrey wrote:
vennela wrote:
binod wrote:

Currently I am using J2EE 1.4 reference implementation.

I don't know what it means, if somebody else understands please jumpin


I think he means http://java.sun.com/j2ee/1.4/download.html#sdk


Thats correct.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Aug 05, 2005 11:29 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

A little bit about the setup
a) you are not referencing a second resource.
b) your inbound stuff (MDB) uses the same resource as your outbound.
c) Why in that case would you call XAResource.start() twice on the same resource ??

Shoudn't you get some kind of IllegalStateException ??

Anyway I am using pure JMS and not JCA.

Enjoy
Back to top
View user's profile Send private message Send e-mail
binod
PostPosted: Mon Aug 08, 2005 6:16 am    Post subject: Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

Thanks for the reply.

There are two XAResources objects taking part in the transaction. One for the inbound message and other for the outbound message. Since isSameRM for both these resources return true, the TM (as per DTP/XA spec) will call XAResource.start(xid, XAResource.TMJOIN) . Also the XID wll have same branch ID for both Inbound and outbound messages.

Now, I would expect the RM (in this case MQ series) to allow the TM to join the transaction. However RM is just hanging here.

Comments?
Back to top
View user's profile Send private message
vennela
PostPosted: Mon Aug 08, 2005 9:15 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Is this working with XA disabled?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
binod
PostPosted: Mon Aug 08, 2005 7:48 pm    Post subject: Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

When there are two resources, you need XA. When I have only one resource (remove sending reply to reply queue), then things start working.

Also, instead of sending reply to MQ series, if I direct to another JMS provider app works. I also hacked the RA and introduced a XAResourceWrapper (for testing purposes) and tried overriding isSameRM and started returning true. Things started working.

PLEASE HELP.... I AM LOST.....

Google tells me that I am not alone.

http://wldj.sys-con.com/read/42825.htm

- Binod
Back to top
View user's profile Send private message
binod
PostPosted: Tue Aug 09, 2005 11:08 pm    Post subject: Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

PLEASE HELP....
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Aug 10, 2005 5:45 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Have you read up on the JCA specification and the way it is supposed to work? (see Sun site).

I still think what you have is an illegal state. Why would you join the same resource twice to the transaction ??. If you do not have a different configuration for the resource adapter (connecting to 2 different qmgrs) this is what you are effectively doing.

Use common sense...
Back to top
View user's profile Send private message Send e-mail
binod
PostPosted: Wed Aug 10, 2005 8:14 pm    Post subject: Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

fjb_saper wrote:
Have you read up on the JCA specification and the way it is supposed to work? (see Sun site).

Use common sense...


I am/was the implementation lead for JCA 1.5 spec in Sun's J2EE team. So, ya... I did read JCA spec... But these things are better explained in JTA spec, OTS spec and DTP/XA spec and JCA spec should just refer them. I thought thats what JCA spec is doing.

If you know of any relevent portion of JCA spec that overrides TMJOIN then please let me know. I can definitely read that again.

*As far as TM is concerned there are TWO XAResource objects. One for the inbound and second for outbound. Hope you agree*

Now, TM will use XAResource.isSameRM to see if XAResource objects are from the same RM. If the XAResource object returns true, then TM will assume that the both XAResources belong to same RM. Until here, things are fine. MQ series' XAResourceObject returns true as both resources belong to same QM.

As per the transaction specifications mentioned above, TM will call XAResource.start(XID,TMJOIN) and ask the XAResource to join the transaction branch which is already started. Note that RM is supposed to treat TMJOIN and TMNOFLAGS differently.

Are you saying that TM should not call XAResource.start() at all, for the second XAResource object?

As TMs are implemented by different vendors like IBM, BEA, Sun, JBOSS etc.. I thought it is difficuilt to change this behaviour.

- Binod.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 11, 2005 6:31 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Well let's look at what the RA is doing:

a) my understanding is that the RA is just a wrapper of the JMS implementation.

b) if undercovers you access the same configuration does it mean that you access the same QueueSession ?

1) If you retrieve one instance through JNDI and then get the XAResource from that resource multiple times I would expect the answer to b to be yes

2) If you retrieve two instances through JNDI and then get the XAResource from each I would expect that you may have a different QueueSession

So in short in
1) you already have joined the transaction and might see strange behavior trying it again
2) you should join the XAResource again

However depending on the app server this behavior might be quite different.

I would say it is safe if you can enquire of your XAResource if it participates in the relevant transaction branch and only join if it does not.
This would cover most of your problems.

Don't remember the specifics but you might read up in the JCA on the chapter that speaks about the transaction branching and how this is specifically handled.

Enjoy
Back to top
View user's profile Send private message Send e-mail
binod
PostPosted: Fri Aug 12, 2005 12:38 am    Post subject: Reply with quote

Novice

Joined: 05 Aug 2005
Posts: 19

Yes, RA is a wrapper above JMS implementation.

However It does not use the same QueueSession undercovers. It should not.

Both MDB deployment descriptor and outbound connection pool configuration accept the JNDI name of the XAQCF of MQ series.

Lets suppose user has configured XAQCF1 for inbound resource and XAQCF2 for outbound resource.

For Inbound communication it uses XAResource xar1 =XAQCF1.createQueueCOnnection.createXAQueueSession().getXAResource();

So, TM does xar1.start(xid, XAResource.TMNOFLAGS);

For outbound resource RA do

XAResource xar2 = XAQCF1.createQueueCOnnection.createXAQueueSession().getXAResource();

TM does
if (xar2.isSameRM(xar1)) {
xar2.start(xid, XAResource.TMJOIN) // HANGGGGGGGGG
}

Do you understand XAResource.TMJOIN and XAResource.TMNOFLAGS? Can you discuss, where these flags will be used? Are you saying that a TM should never worry about these flags?

As I said.. JCA spec does not deal with these details. Please try to understand whats happening rather than sticking on to "XAResource.start should not have been called twice". The issue is little more deeper than that.....

Lets come to the point and then discuss...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3  Next Page 1 of 3

MQSeries.net Forum Index » IBM MQ Java / JMS » MQSeries Issue/ Generic RA for JMS
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.