Commit() method of QueueSession throw an Exception (WebSphere MQ + Jboss 7)
sbourguiba Jun 30, 2012 1:00 PMHi,
I have configured WebSphere MQ 7 with Jboss 7 and my problem is when i create a new QueueSession with transacted=true, an instance of a queue session (com.ibm.mq.connector.outbound.QueueSessionWrapper) is returned with a false transacted flag.
So when i call commit method an exception is thrown:
Caused by: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0014: The application called a method that must not be called on a nontransacted session.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:313)
at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:390)
at com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:104)
at com.ibm.msg.client.jms.internal.JmsSessionImpl.commit(JmsSessionImpl.java:498)
at com.ibm.mq.jms.MQSession.commit(MQSession.java:214)
at com.ibm.mq.connector.outbound.SessionWrapper.commit(SessionWrapper.java:218)
Code:
Javax.jms.QueueConnection connection = factory.createQueueConnection();
Javax.jms.QueueSession session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
QueueReceiver reciever = session.createReceiver(getRecieverQueue());
connection.start();
/*
*/
session.commit();
standalone.xml configuration:
<resource-adapters>
<resource-adapter>
<archive>wmq.jmsra.rar</archive>
<transaction-support>LocalTransaction</transaction-support>
<connection-definitions>
<connection-definition
class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl"
jndi-name="java:/ManagedConnectionFactory" enabled="true"
pool-name="ManagedConnectionFactory">
<config-property name="port">1414</config-property>
<config-property name="hostName">*.*.*.*</config-property>
<config-property name="channel">MyChannel
</config-property>
<config-property name="transportType">CLIENT</config-property>
<config-property name="queueManager">myqm</config-property>
<pool>
<min-pool-size> 1 </min-pool-size>
<max-pool-size>
10
</max-pool-size>
<prefill> false </prefill>
<use-strict-min> false </use-strict-min>
</pool>
<security>
<application />
</security>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy"
jndi-name="Test" enabled="true" use-java-context="false"
pool-name="Test">
<config-property name="baseQueueName">Test</config-property>
<config-property name="baseQueueManagerName">myqm</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
</resource-adapters>
Any idea?
Regards,