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 » Multiphase Commit » Weblogic 11g WebSphere 6.0 JMS XA Transaction Question

Post new topic  Reply to topic
 Weblogic 11g WebSphere 6.0 JMS XA Transaction Question « View previous topic :: View next topic » 
Author Message
kevinb11
PostPosted: Tue Feb 22, 2011 12:54 pm    Post subject: Weblogic 11g WebSphere 6.0 JMS XA Transaction Question Reply with quote

Newbie

Joined: 22 Feb 2011
Posts: 6

Hi All-

I am doing a POC and I'm kinda stuck on a XA problem. I am working from a common IBM example that worked fine but now I'm trying to get it to work with XA code. The error message I get is:

Exception:
Code:


MQJMS2007: failed to send message to MQ 
MQJE001: Completion Code 2, Reason 2072   



My code is as follows:

Code:

  public void testSend() {
     
    XAQueueConnectionFactory  queueConnectionFactory = null;
    XAQueueConnection queueConnection = null;
    XAQueueSession xaqueueSession = null;
    Context jndiContext = null;
    Queue queue = null;
    QueueSender queueSender = null;
    QueueSession queueSession = null;
    String queueName = "jms/WLMyReplyQueue";
   
    try {
      jndiContext = new InitialContext();
     
      queueConnectionFactory = (XAQueueConnectionFactory) jndiContext.lookup("jms/WLSenderQCF");
   
     
      System.out.println("looked up QueueConnectionFactory: " + queueConnectionFactory);
       
      queue = (Queue)jndiContext.lookup(queueName);
     
      System.out.println("looked up Queue: " + queue);
       
    } catch (NamingException e) {
      System.out.println("JNDI Problem: ");
      e.printStackTrace();
    }

    try {     
     
       
      queueConnection = queueConnectionFactory.createXAQueueConnection();
         
       
      xaqueueSession = queueConnection.createXAQueueSession();
     
     
      Message msg = xaqueueSession.createTextMessage("Hello From Test");
     
      queueSession = xaqueueSession.getQueueSession();
     
     
      queueSender = queueSession.createSender(queue);   
         
     
      queueSender.send(msg);
             
     
     
      System.out.println("Message send");

    } catch (Exception e) {
      System.out.println("Exception: ");
      e.printStackTrace();
      if (e instanceof JMSException) {
        ((JMSException) e).getLinkedException().printStackTrace();
      }
    } finally {
      try {
        System.out.println("Closing Connection");
        queueSession.close();
        queueConnection.close();

      } catch (Exception e) {
        System.out.println("Exception: ");
        e.printStackTrace();
        if (e instanceof JMSException) {
          ((JMSException) e).getLinkedException().printStackTrace();
        }
      }

    }

  }


Any thoughts?

Thanks!
Kevin
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Feb 22, 2011 12:57 pm    Post subject: Re: Weblogic 11g WebSphere 6.0 JMS XA Transaction Question Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kevinb11 wrote:
Any thoughts?


From the documentation:

Quote:
This reason code can also occur on the MQGET, MQPUT, and MQPUT1 calls when an external unit-of-work coordinator is being used. If that coordinator requires an explicit call to start the unit of work, but the application has not issued that call prior to the MQGET, MQPUT, or MQPUT1 call, reason code MQRC_SYNCPOINT_NOT_AVAILABLE is returned.


I don't know Weblogic from a hole in the ground - does it require such a call? Is the queue manager properly configured to participate in an XA transaction?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kevinb11
PostPosted: Tue Feb 22, 2011 1:07 pm    Post subject: Reply with quote

Newbie

Joined: 22 Feb 2011
Posts: 6

Thanks for the reply. Where would I find in WebSphere explorer if Queue is set up to do XA transactions? I've been looking....
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Feb 22, 2011 2:29 pm    Post subject: Reply with quote

Grand High Poobah

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

kevinb11 wrote:
Thanks for the reply. Where would I find in WebSphere explorer if Queue is set up to do XA transactions? I've been looking....

Nowhere.
A queue is never set up for XA transactions.
A QCF/TCF/CF needs to be setup for XA transactions.

In your case you did not specify whether the qmgr was on the same box as your Weblogic server, nor did you specify whether you are using a client connection (channel). Now if you are using a client connection, did you make certain that you have
  • a properly licensed ETC (Extended Transactional Client).
  • the corresponding jar file for the etc on the classpath


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kevinb11
PostPosted: Tue Feb 22, 2011 3:02 pm    Post subject: Reply with quote

Newbie

Joined: 22 Feb 2011
Posts: 6

Hi fjb_saper-

WebSphere is on the same box and yes I have the com.ibm.mqetclient.jar in my classpath. As far as I know we have an enterprise license for it.

In my JNDI .bindings file I have also located this entry:
SenderQCF/FactoryName=com.ibm.mq.jms.MQXAQueueConnectionFactoryFactory

There was another post about this and it seems like I am doing exactly like this person was..
http://www.mqseries.net/phpBB2/viewtopic.php?t=48333

The example that I followed is here, then I starting changing the put code to add the XA stuff.
http://www.ibm.com/developerworks/websphere/library/techarticles/0604_kesavan/0604_kesavan.html

Thanks,
Kevin
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Feb 22, 2011 9:03 pm    Post subject: Reply with quote

Grand High Poobah

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

After having defined everything as per the second link, did you review your configuration as per the first link?

You are trying to do a multiphase commit, can you show us the code where you create the relevant javax.jms.Session ?

I gather this is it:
Code:
  queueConnection = queueConnectionFactory.createXAQueueConnection();
         
       
      xaqueueSession = queueConnection.createXAQueueSession();
     
     
      Message msg = xaqueueSession.createTextMessage("Hello From Test");
     
      queueSession = xaqueueSession.getQueueSession();
     
     
      queueSender = queueSession.createSender(queue);   
         
     
      queueSender.send(msg);


I would suggest that you use following:
Code:
queueSession = queueConnection.createSession(true, Session.AUTO_ACKNOWLEDGE);


and let us know how it went.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kevinb11
PostPosted: Tue Feb 22, 2011 9:21 pm    Post subject: Reply with quote

Newbie

Joined: 22 Feb 2011
Posts: 6

This code compiles, but it bombs on queueSender.send(msg);
Code:

  public void testSend() {
     
    XAQueueConnectionFactory  queueConnectionFactory = null;
    XAQueueConnection queueConnection = null;
    XAQueueSession xaqueueSession = null;
    Context jndiContext = null;
    Queue queue = null;
    QueueSender queueSender = null;
    QueueSession queueSession = null;
    String queueName = "jms/WLMyReplyQueue";
   
    try {
      jndiContext = new InitialContext();
     
      queueConnectionFactory = (XAQueueConnectionFactory) jndiContext.lookup("jms/WLSenderQCF");
   
     
      System.out.println("looked up QueueConnectionFactory: " + queueConnectionFactory);
       
      queue = (Queue)jndiContext.lookup(queueName);
     
      System.out.println("looked up Queue: " + queue);
       
    } catch (NamingException e) {
      System.out.println("JNDI Problem: ");
      e.printStackTrace();
    }

    try {     
     
       
      queueConnection = queueConnectionFactory.createXAQueueConnection();
         
       
      xaqueueSession = queueConnection.createXAQueueSession();
       
      Message msg = xaqueueSession.createTextMessage("Hello From Test");
     
      queueSession = xaqueueSession.getQueueSession();
     
      queueSender = queueSession.createSender(queue);   
         
     
      queueSender.send(msg);
             
     
     
      System.out.println("Message send");

    } catch (Exception e) {
      System.out.println("Exception: ");
      e.printStackTrace();
      if (e instanceof JMSException) {
        ((JMSException) e).getLinkedException().printStackTrace();
      }
    } finally {
      try {
        System.out.println("Closing Connection");
        queueSession.close();
        queueConnection.close();

      } catch (Exception e) {
        System.out.println("Exception: ");
        e.printStackTrace();
        if (e instanceof JMSException) {
          ((JMSException) e).getLinkedException().printStackTrace();
        }
      }

    }

  }
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Feb 22, 2011 9:26 pm    Post subject: Reply with quote

Grand High Poobah

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

fjb_saper wrote:

I would suggest that you use following:
Code:
queueSession = queueConnection.createSession(true, Session.AUTO_ACKNOWLEDGE);


and let us know how it went.

Have fun

Have you tried it?

You might also want to take this warning into consideration:
Quote:
The XAQueueConnection interface is optional. JMS providers are not required to support this interface. This interface is for use by JMS providers to support transactional environments. Client programs are strongly encouraged to use the transactional support available in their environment, rather than use these XA interfaces directly.

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kevinb11
PostPosted: Tue Feb 22, 2011 9:55 pm    Post subject: Reply with quote

Newbie

Joined: 22 Feb 2011
Posts: 6

I read that also today and was unsure. That code does run though. Will test more tomorrow along with a XA database update wrapped in one transaction. Will post back results. Thank you very much for your input.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » Multiphase Commit » Weblogic 11g WebSphere 6.0 JMS XA Transaction Question
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.