Hello,
I am trying to use DMLC with Webspere MQ and XA transaction (I use spring 2.5.4). I am trying to figure out the right DMLC configuration. I have set the cache level to CACHE_CONNECTION. The problem is that the JMS connection is closed after each iteration. At the following iteration I get the following error:
I have debugged for a while and I think the error comes from the fact that when creating the session, it is automatically registered within the transaction manager and it will be closed once the transaction is finished (in AbstractPollingMessageListenerContainer.doReceiveA ndExecute, the method ConnectionFactoryUtils.doGetTransactionalSession is used for creating the session and it registers the JmsResourceSynchronization which will always close the shared connection). Could this be a bug in the AbstractPollingMessageListenerContainer or maybe there there is a mistake in my DMLC configuration?Code:javax.jms.IllegalStateException: MQJMS1004: Connexion fermée. at com.ibm.mq.jms.MQQueueConnection.createQueueSession(MQQueueConnection.java:374) at com.ibm.mq.jms.MQQueueConnection.createQueueSession(MQQueueConnection.java:234) at com.ibm.mq.jms.MQQueueConnection.createSession(MQQueueConnection.java:579) at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.access$200(AbstractPollingMessageListenerContainer.java:77) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer$MessageListenerContainerResourceFactory.createSession(AbstractPollingMessageListenerContainer.java:504) at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:282) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:285) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:240) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:944) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:868) at java.lang.Thread.run(Thread.java:619)
Here is my DMLC configuration:
Regards,Code:<bean id="jmsListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" > <property name="connectionFactory" ref="jndiXaConnectionFactory"/> <property name="destinationName" value="${JMS_INPUT_DESTINATION}"/> <property name="transactionManager" ref="transactionManager"/> <property name="maxConcurrentConsumers" value="${JMS_CONSUMERS}"/> <property name="receiveTimeout" value="${JMS_RECEIVE_TIMEOUT}"/> <property name="cacheLevelName" value="CACHE_CONNECTION"/> </bean>
Mihai


Reply With Quote
You want to use JTA transaction and that's the backbone (Spring's JtaTransactionManager just delegates to the underlying JTA provider). That provider may obey new connection per new transaction usage but you violate that via setting cache level to CACHE_CONNECTION. So, you just don't follow the rules of the used JTA provider here.
You're free to define any suitable caching level at the pure jms communications (without jta) and have to follow the rules implied by particular jta provider usage.
. Normally, if the JMS connection is shared (CACHE_SESSION), one would expect it not to be closed after each message, but rather kept open for the entire DMLC life.
