Author |
Message
|
naor |
Posted: Mon Jun 16, 2008 8:50 am Post subject: Issue with XA Transaction (MQJMS1068) |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
I am setting up an MQ XA test.
I am running a java client using Spring 2.0 and Atomikos 3.3.1 as the Transaction Manager.
My Queue Manager is IBM MQ 6.0 running on a remote Solaris box
Here is the Spring configuration I'm using for the client:
Code: |
<bean id="mqConnectionFactory" class="com.ibm.mq.jms.MQXAQueueConnectionFactory">
<property name="queueManager" value="MYQMGR"/>
<property name="hostName" value="myhost"/>
<property name="port" value="1430"/>
<property name="channel" value="CH.MYQMGR.SRVC"/>
<!-- transportType=1 for TCP client -->
<property name="transportType" value="1"/>
<property name="clientID" value="mqm"/>
</bean>
<bean id="atomikosMqConnectionFactory" class="com.atomikos.jms.QueueConnectionFactoryBean">
<property name="xaQueueConnectionFactory" ref="mqConnectionFactory"/>
<!-- IMPORTANT: the resourceName MUST contain MQSeries_XA_RMI -->
<property name="resourceName" value="My_MQSeries_XA_RMI"/>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="atomikosMqConnectionFactory"/>
<property name="username" value=" "/>
<property name="password" value=" "/>
</bean>
<bean id="inputQueueMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" lazy-init="false">
<property name="connectionFactory" ref="jmsQueueConnectionFactory"/>
<property name="destination" ref="myQueue"/>
<property name="messageListener" ref="myQueueMessageListener"/>
<property name="transactionManager" ref="xaTransactionManager"/>
<property name="concurrentConsumers" value="1"/>
<property name="sessionTransacted" value="true"/>
</bean>
<bean id="myQueue" class="com.ibm.mq.jms.MQQueue">
<property name="baseQueueManagerName" value="MYQMGR"/>
<property name="baseQueueName" value="MYQUEUE"/>
</bean>
<bean id="myQueueMessageListener" class="com.itp.gt.queue.MQQueueListener"/> |
My listener simply logs the message to the console but after the first message is logged I am getting the following JMS Exception:
javax.jms.JMSException: MQJMS1068: failed to obtain XAResource
Any help to figure out what I am doing wrong would be greatly appreciated.
Thanks,
naor |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 16, 2008 10:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Help us to help yourself...
On every JMSException you need to display the LinkedException if it exists
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
naor |
Posted: Mon Jun 16, 2008 1:06 pm Post subject: |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
Thanks for the response, here is the full stacktrace:
Code: |
[testng] javax.jms.JMSException: MQJMS1068: failed to obtain XAResource
[testng] at com.ibm.mq.jms.services.ConfigEnvironment.newException(Ljava.lang.String;)Ljavax.jms.JMSException;(ConfigEnvironment.java:567)
[testng] at com.ibm.mq.jms.MQXAQueueConnection.createXAQueueSession()Ljavax.jms.XAQueueSession;(MQXAQueueConnection.java:108)
[testng] at com.atomikos.jms.JtaQueueConnection.createQueueSession(ZI)Ljavax.jms.QueueSession;(Unknown Source)
[testng] at com.atomikos.jms.JtaQueueConnection.createSession(ZI)Ljavax.jms.Session;(Unknown Source)
[testng] at org.springframework.jms.support.JmsAccessor.createSession(Ljavax.jms.Connection;)Ljavax.jms.Session;(JmsAccessor.java:200)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.access$200(Lorg.springframework.jms.listener.AbstractPolli
ngMessageListenerContainer;Ljavax.jms.Connection;)Ljavax.jms.Session;(AbstractPollingMessageListenerContainer.java:75)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer$MessageListenerContainerResourceFactory.createSession(Ljav
ax.jms.Connection;)Ljavax.jms.Session;(AbstractPollingMessageListenerContainer.java:465)
[testng] at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(Ljavax.jms.ConnectionFactory;Lorg.springframewo
rk.jms.connection.ConnectionFactoryUtils$ResourceFactory;)Ljavax.jms.Session;(ConnectionFactoryUtils.java:252)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(Ljavax.jms.Session;Ljavax.jms.MessageC
onsumer;Lorg.springframework.transaction.TransactionStatus;)Z(AbstractPollingMessageListenerContainer.java:278)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(Ljavax.jms.Session;Ljavax.jms.MessageCon
sumer;)Z(AbstractPollingMessageListenerContainer.java:234)
[testng] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener()Z(DefaultMessageListen
erContainer.java:871)
[testng] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run()V(DefaultMessageListenerContainer
.java:811)
[testng] at java.lang.Thread.run()V(Unknown Source)
[testng] at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
|
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 16, 2008 6:51 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Sorry but I doubt very much that this is the full stack trace:
a) it is way too short
b) it does not contain a caused by or root cause
c) I still don't see any LinkedException
d) It does not contain a reason code
Now you can certainly catch the Exception.
Once caught dig into the Exceptions like you would peel an onion. Once you get to the JMSException look for the LinkedException.
It is the only way to get the JMS provider's error code. And that is the only meaningful way of resolving your dilemma...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
naor |
Posted: Mon Jun 16, 2008 7:54 pm Post subject: |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
not sure what else I could do to make the point.
this is the entire stack trace i get.
there is no Caused by in the trace.
isnt this the jms provider's error code??? - MQJMS1068 |
|
Back to top |
|
 |
naor |
Posted: Mon Jun 16, 2008 8:04 pm Post subject: |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
One more thing to mention:
the only code i wrote for this example is the listener (the last bean in the spring configuration above) which is not even being called at this point so i cannot catch the exception. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jun 17, 2008 4:02 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
FJ -
What part of "XA" and "Client" did you misread?
Naor - you can't do this without the Extended Transactional Client or a bindings connection to a local queue manager. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
naor |
Posted: Tue Jun 17, 2008 4:14 am Post subject: |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
I did read about the need to use the Transactional client in other posts however the answer from IBM support was that there is no special client needed for XA and that using the JMS jars should be sufficient as long as the queue manager supports XA. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 17, 2008 10:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
naor wrote: |
I did read about the need to use the Transactional client in other posts however the answer from IBM support was that there is no special client needed for XA and that using the JMS jars should be sufficient as long as the queue manager supports XA. |
The condition there being that you use WAS V 6.x and the WAS transaction manager...
Otherwise as Jeff specified you need the ETC.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
naor |
Posted: Tue Jun 17, 2008 10:28 am Post subject: |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
Thanks for your help.
I compared the jars I had on my local client install and on the MQ server install and found the mystery transactional client.
the jar I was missing is called com.ibm.mqetclient.jar and once added to the client's classpath I no longer get the MQJMS1068 error.
Now when I run my simple example i get the following exception:
Quote: |
[testng] Jun-17-2008 14:14:11 ERROR (DefaultMessageListenerContainer.java:667) - Setup of JMS message listener invoker failed - trying to recover
[testng] javax.jms.JMSException: MQJMS1017: non-local MQ queue not valid for receiving or browsing
[testng] at com.ibm.mq.jms.services.ConfigEnvironment.newException(Ljava.lang.String;)Ljavax.jms.JMSException;(ConfigEnvironment.java:567)
[testng] at com.ibm.mq.jms.MQSession.createQReceiver(Ljavax.jms.Queue;Ljava.lang.String;)Ljavax.jms.QueueReceiver;(MQSession.java:6006)
[testng] at com.ibm.mq.jms.MQQueueSession.createReceiver(Ljavax.jms.Queue;Ljava.lang.String;)Ljavax.jms.QueueReceiver;(MQQueueSession.java:276)
[testng] at com.ibm.mq.jms.MQQueueSession.createConsumer(Ljavax.jms.Destination;Ljava.lang.String;)Ljavax.jms.MessageConsumer;(MQQueueSession.j
ava:330)
[testng] at com.atomikos.jms.DefaultJtaSession.createConsumer(Ljavax.jms.Destination;Ljava.lang.String;)Ljavax.jms.MessageConsumer;(Unknown Sou
rce)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createConsumer(Ljavax.jms.Session;Ljavax.jms.Destination;)
Ljavax.jms.MessageConsumer;(AbstractPollingMessageListenerContainer.java:437)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createListenerConsumer(Ljavax.jms.Session;)Ljavax.jms.Mess
ageConsumer;(AbstractPollingMessageListenerContainer.java:216)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(Ljavax.jms.Session;Ljavax.jms.MessageC
onsumer;Lorg.springframework.transaction.TransactionStatus;)Z(AbstractPollingMessageListenerContainer.java:297)
[testng] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(Ljavax.jms.Session;Ljavax.jms.MessageCon
sumer;)Z(AbstractPollingMessageListenerContainer.java:234)
[testng] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener()Z(DefaultMessageListen
erContainer.java:871)
[testng] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run()V(DefaultMessageListenerContainer
.java:811)
[testng] at java.lang.Thread.run()V(Unknown Source)
[testng] at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source) |
my queue is defined on using the following script on the queue manager box:
Code: |
DEFINE QLOCAL('MY_Q') USAGE(NORMAL); |
Any idea what might be causing this? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jun 17, 2008 2:20 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
naor wrote: |
Now when I run my simple example i get the following exception:
Quote: |
[testng] Jun-17-2008 14:14:11 ERROR (DefaultMessageListenerContainer.java:667) - Setup of JMS message listener invoker failed - trying to recover
[testng] javax.jms.JMSException: MQJMS1017: non-local MQ queue not valid for receiving or browsing
|
my queue is defined on using the following script on the queue manager box:
Code: |
DEFINE QLOCAL('MY_Q') USAGE(NORMAL); |
Any idea what might be causing this? |
Sure but what destination did you use to build the receiver the MessageListener is attached to?
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
naor |
Posted: Wed Jun 18, 2008 5:03 am Post subject: |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
This is the destination i am using:
Code: |
<bean id="myQueue" class="com.ibm.mq.jms.MQQueue">
<property name="baseQueueManagerName" value="MYQMGR"/>
<property name="baseQueueName" value="MY_Q"/>
</bean> |
|
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 18, 2008 7:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
naor wrote: |
This is the destination i am using:
Code: |
<bean id="myQueue" class="com.ibm.mq.jms.MQQueue">
<property name="baseQueueManagerName" value="MYQMGR"/>
<property name="baseQueueName" value="MY_Q"/>
</bean> |
|
So you checked that your connection factory is attaching to qmgr 'MYQMGR" and that queue "MY_Q" is defined as QL on "MYQMGR".
You also verified that the user being passed on the CF has the right permissions for the queue? (at the very least inq + browse + get )
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
naor |
Posted: Thu Jun 19, 2008 11:30 am Post subject: |
|
|
Newbie
Joined: 16 Jun 2008 Posts: 8
|
Found a typo in my configuration.
Now it works like charm.
Thanks for the help! |
|
Back to top |
|
 |
chauhan_vin1 |
Posted: Fri Sep 24, 2010 9:30 am Post subject: MQJMS1068 |
|
|
Apprentice
Joined: 24 Feb 2006 Posts: 36 Location: Phoenix AZ
|
Jeff / Saber,
If you guys still following this thread , I am also getting this MQJMS1068 error all of a sudden , we had a stable environment , but since last week we have started getting this error.
We use Webshere MQ ver 6.x ( mainframes) as the JMS provider for one of out project in Webshere Process Server 6.0.2.5
We connect to the remote MQ as client , and the MDB used listener ports. After restarting the server connection channel on the Queuemanager , we see that the listenerPorts gets started, but whenever there is any trasaction , we see the MQJMS1068 error...
I have even traced the error to find the linked exception , the linked exception is :
------------------------------------------------------------------------------
linked exception javax.transaction.xa.XAException: xa_open failed
linked exception reasonCode: -5
-----------------------------------------------------------------------------
Here is how the trace look :
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA < com.ibm.mq.MQInternalCommunications receiveBytes Exit
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA < com.ibm.mq.MQInternalCommunications receive Exit
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA 3 java.lang.String Releasing lock on MQInternalCommunications object
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA < com.ibm.mq.MQSESSIONClient lowLevelComms Exit
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.MQSESSIONClient result=-5
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA < com.ibm.mq.MQSESSIONClient XAOPEN Exit
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.MQXAResource throwing javax.transaction.xa.XAException: xa_open failed
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.MQXAResource errorCode=-5
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA < com.ibm.mq.MQXAResource constructor Exit
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.MQXAQueueManager throwing javax.transaction.xa.XAException: xa_open failed
[9/24/10 7:02:27:714 PDT] 000000d3 JMS_WASTraceA < com.ibm.mq.MQXAQueueManager getXAResource Exit
[9/24/10 7:02:27:715 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.jms.MQXAQueueConnection throwing javax.jms.JMSException: MQJMS1068: failed to obtain XAResource
[9/24/10 7:02:27:715 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.jms.MQXAQueueConnection linked exception javax.transaction.xa.XAException: xa_open failed
[9/24/10 7:02:27:715 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.jms.MQXAQueueConnection linked exception reasonCode: -5
[9/24/10 7:02:27:715 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.jms.MQXAQueueConnection Disabling XA transaction mode on MQQueueSession
[9/24/10 7:02:27:715 PDT] 000000d3 JMS_WASTraceA 3 com.ibm.mq.jms.MQQueueSession setDistTransactionMode setting mode to 0
[9/24/10 7:02:27:715 PDT] 000000d3 JMS_WASTraceA < com.ibm.mq.jms.MQXAQueueConnection createXAQueueSession Exit
[9/24/10 7:02:27:715 PDT] 000000d3 JMSManagedQue < createXASession Exit
<null>
[9/24/10 7:02:27:775 PDT] 000000d3 JMSManagedSes 1 Caught exception:
javax.jms.JMSException: MQJMS1068: failed to obtain XAResource
----------------------------------------------------------------------------------
I am not finding anywhere what the statusCode -5 means , I would keep IBM PMR as the last option |
|
Back to top |
|
 |
|