Announcement Announcement Module
Collapse
No announcement yet.
JMS Message Listener failing trying to recover Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMS Message Listener failing trying to recover

    I have a stand-alone application that uses the MDP inside a MessageListenerContainer to process messages on a queue. However, if I shutdown the server the queue is running on and then restart it, I get the following error:

    Code:
    ERROR DefaultMessageListenerContainer - Setup of JMS message listener invoker failed - trying to recover
    javax.jms.JMSException: CWSIA0053E: An exception was received during the call to the method JmsSessionImpl.<constructor>: com.ibm.wsspi.sib.core.exception.SIConnectionDroppedException: CWSIJ0047E: An operation was attempted on a connection that is already closed..
        at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.<init>(JmsSessionImpl.java:389)
        at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.<init>(JmsQueueSessionImpl.java:92)
        at com.ibm.ws.sib.api.jms.impl.JmsQueueConnectionImpl.instantiateSession(JmsQueueConnectionImpl.java:267)
        at com.ibm.ws.sib.api.jms.impl.JmsConnectionImpl.createSession(JmsConnectionImpl.java:316)
        at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.jms.connection.SingleConnectionFactory$SharedConnectionInvocationHandler.invoke(SingleConnectionFactory.java:423)
        at $Proxy0.createSession(Unknown Source)
        at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:200)
        at org.springframework.jms.listener.DefaultMessageListenerContainer.access$1200(DefaultMessageListenerContainer.java:116)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:900)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:886)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:815)
        at java.lang.Thread.run(Thread.java:595)
    Caused by: com.ibm.wsspi.sib.core.exception.SIConnectionDroppedException: CWSIJ0047E: An operation was attempted on a connection that is already closed.
        at com.ibm.ws.sib.jfapchannel.impl.ConversationImpl.send(ConversationImpl.java:965)
        at com.ibm.ws.sib.jfapchannel.impl.ConversationImpl.exchange(ConversationImpl.java:834)
        at com.ibm.ws.sib.comms.common.JFAPCommunicator.JFAPExchange(JFAPCommunicator.java:376)
        at com.ibm.ws.sib.comms.client.ConnectionProxy.createUniqueId(ConnectionProxy.java:3214)
        at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.<init>(JmsSessionImpl.java:348)
        ... 14 more
    Here is my spring-jms.xml file:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//Spring//DTD Bean//EN" 
        "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
    
        <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://jmsqa.penske.com:20810
                    </prop>
                    <prop key="com.ibm.CORBA.ORBInit">
                        com.ibm.ws.sib.client.ORB
                    </prop>
                </props>
            </property>
        </bean>
    
        <bean id="internalJmsQueueConnectionFactory"
            class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiTemplate">
                <ref bean="jndiTemplate" />
            </property>
            <property name="jndiName">
                <value>jms/test_factory</value>
            </property>
        </bean>
    
        <bean id="jmsQueueConnectionFactory"
            class="org.springframework.jms.connection.SingleConnectionFactory">
            <property name="targetConnectionFactory">
                <ref bean="internalJmsQueueConnectionFactory" />
            </property>
        </bean>
    
        <bean id="internalJmsQueueFactory"
            class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiTemplate">
                <ref bean="jndiTemplate" />
            </property>
            <property name="jndiName">
                <value>jms/test_queue</value>
            </property>
        </bean>
    
        <bean id="messageListener"
            class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
            <constructor-arg>
                <bean class="com.penske.architect.jms.spring.client.delegates.impl.ObjectMessageDelegateImpl" />
            </constructor-arg>
        </bean>
    
        <bean id="jmsContainer"    class="org.springframework.jms.listener.DefaultMessageListenerContainer">
            <property name="connectionFactory" ref="jmsQueueConnectionFactory" />
            <property name="destination" ref="internalJmsQueueFactory" />
            <property name="messageListener" ref="messageListener" />
            <property name="maxConcurrentConsumers">
                <value>1</value>
            </property>
        </bean>
    
    </beans>
    As I understand it, the default caching level for a listener container is NONE. So I do not understand why I would get an error using a connection that was already closed if it is not being cached.

    Can anyone explain what I am doing wrong here?

    I am using Spring 2.5 on a Sun JDK 1.5.0_12.

    Thanks,

  • #2
    Because you are using a SingleConnectionFactory. It does cache the connection. You should use internalJmsQueueConnectionFactory directly as the connection factory.

    Comment


    • #3
      That did the trick! Thanks.

      Comment

      Working...
      X