This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes Spring JMS Issue : javax.jms.IllegalStateException: Session closed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring JMS Issue : javax.jms.IllegalStateException: Session closed" Watch "Spring JMS Issue : javax.jms.IllegalStateException: Session closed" New topic
Author

Spring JMS Issue : javax.jms.IllegalStateException: Session closed

sagar chandgude
Greenhorn

Joined: Nov 09, 2010
Posts: 5
Hi,
My requirement is to migrate from MDB to MDP.

My applicationContext.xml
----------------------------------
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.ibm.websphere.naming.WsnInitialContextFactory</prop>
<prop key="java.naming.provider.url">iiop://localhost:2809/</prop>
</props>
</property>
</bean>

<bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>jms/ATS/QueueConnectionFactory</value>
</property>
</bean>

<bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
</bean>


<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="queueConnectionFactory" />
</property>
<property name="destinationResolver">
<ref bean="jmsDestinationResolver" />
</property>
</bean>

<bean id="destinationQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>jms/ATS/receiverqueue</value>
</property>
</bean>

<bean id="cacheListener" class="com.americanexpress.ats.util.app.cache.CacheMDB"/>

<bean id="Invoicelistener" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="concurrentConsumers" value="20" />
<property name="connectionFactory" ref="queueConnectionFactory" />
<property name="destination" ref="destinationQueue" />
<property name="messageListener" ref="cacheListener" />
</bean>
----------------------------------

Now I am starting listner explicitly (As my application is in simple java project ) before sending message
----------------------------------
beanFactory = new XmlBeanFactory(new ClassPathResource("/WEB-INF/applicationContext.xml"));
listner =(DefaultMessageListenerContainer) beanFactory.getBean("Invoicelistener");
listner.start();
----------------------------------

onMessage method is getting called but I am facing the below exception on console.
----------------------------------

[11/10/10 11:57:57:510 IST] 00000320 DefaultMessag W org.springframework.jms.listener.AbstractMessageListenerContainer handleListenerException Execution of

JMS message listener failed
javax.jms.IllegalStateException: Session closed
at com.ibm.ejs.jms.JMSSessionHandle.getOpenSession(JMSSessionHandle.java:1231)
at com.ibm.ejs.jms.JMSSessionHandle.getOpenUnifiedSession(JMSSessionHandle.java:1268)
at com.ibm.ejs.jms.JMSSessionHandle.getTransacted(JMSSessionHandle.java:600)
at org.springframework.jms.listener.AbstractMessageListenerContainer.commitIfNecessary(AbstractMessageListenerContainer.java:554)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:465)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
at

org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
at java.lang.Thread.run(Thread.java:810)

[11/10/10 11:57:57:525 IST] 00000320 DefaultMessag I org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure Setup of JMS

message listener invoker failed for destination 'queue://ATS/GNAXX.ATS.CACHEREFRESH.SERVER1.D00' - trying to recover. Cause: Session closed
[11/10/10 11:57:59:072 IST] 00000323 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for

resource jms/ATS/QueueConnectionFactory. The exception which was received is javax.jms.IllegalStateException: MQJMS3033: QueueReceiver is closed
[11/10/10 11:57:59:447 IST] 00000324 DefaultMessag I org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure Setup of JMS

message listener invoker failed for destination 'queue://ATS/GNAXX.ATS.CACHEREFRESH.SERVER1.D00' - trying to recover. Cause: Connection closed
[11/10/10 11:57:59:588 IST] 0000031d SystemOut O storedProcedureId--------DimensionCache
[11/10/10 11:57:59:603 IST] 0000031d SystemOut O Getting the RESULTSET FROM THE STOREDPROC************************
[11/10/10 11:57:59:713 IST] 00000325 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for

resource JMS$QueueConnectionFactory$JMSManagedConnection@668870622. The exception which was received is javax.jms.IllegalStateException: MQJMS3033:

QueueReceiver is closed
[11/10/10 11:57:59:931 IST] 00000326 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for

resource JMS$QueueConnectionFactory$JMSManagedConnection@1449547366. The exception which was received is javax.jms.IllegalStateException: MQJMS3033:

QueueReceiver is closed
[11/10/10 11:57:59:947 IST] 00000327 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for

resource JMS$QueueConnectionFactory$JMSManagedConnection@1427002638. The exception which was received is javax.jms.IllegalStateException: MQJMS3033:

QueueReceiver is closed
----------------------------------

Also we have maximized the connection & session pool size.
Still the exception gets called multiple times.
----------------------------------

***Any suggestion would be highly appreciated***

Thanks :-)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Spring JMS Issue : javax.jms.IllegalStateException: Session closed
 
Similar Threads
Broker command failed: 3008 Reason code 3008
Error : Spring + Jms Application deployed on Oc4j
Spring JMS with IBM Websphere MQ5.3.1
java.io.FileNotFoundException JspServlet.service
Problem in receiving message from MQ queue