Announcement Announcement Module
Collapse
No announcement yet.
How to recreate connection(created by CachingConnectionFactory) when interrupted Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to recreate connection(created by CachingConnectionFactory) when interrupted

    I create jms inbound adapter which create connection using CachingConnectionFactory,
    environment: spring 2.5.6, si 1.0.2:
    Code:
    	<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
    		<property name="targetConnectionFactory">
    			<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
    				<property name="hostName" value="${jms.mq.host}"/>
    				<property name="port" value="${jms.mq.port}"/>
    				<property name="queueManager" value="${jms.mq.manager.name}"/>
    				<property name="transportType" value="${jms.mq.transport.type}"/>
    				<property name="CCSID" value="${jms.mq.ccsid}"/>	
    			</bean>
    		</property>
    		<property name="sessionCacheSize" value="10"/>
    		<property name="cacheProducers" value="false"/>
    	</bean>
    
    	<integration:poller id="poller" default="true">
    		<integration:interval-trigger interval="1000"/>
    	</integration:poller>
    
    	<jms:inbound-channel-adapter id="jmsInAdapter" destination-name="${jms.mq.queue.receive.name}" channel="jmsin"/>
    
        ...
    But when the connection interrupted, spring throws exception:
    Code:
    [ERROR]2010-08-08 19:10:16,406 org.springframework.integration.handler.LoggingHandler.(LoggingHandler.java:71):org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: MQJMS2002: failed to get message from MQ queue; nested exception is com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2019
    	at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:308)
    	at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
    	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:474)
    	at org.springframework.jms.core.JmsTemplate.receiveSelected(JmsTemplate.java:708)
    	at org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:686)
    	at org.springframework.jms.core.JmsTemplate.receive(JmsTemplate.java:677)
    	at org.springframework.jms.core.JmsTemplate.receiveAndConvert(JmsTemplate.java:784)
    	at org.springframework.integration.jms.JmsDestinationPollingSource.receive(JmsDestinationPollingSource.java:68)
    	at org.springframework.integration.endpoint.SourcePollingChannelAdapter.doPoll(SourcePollingChannelAdapter.java:76)
    	at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.innerPoll(AbstractPollingEndpoint.java:232)
    	at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.poll(AbstractPollingEndpoint.java:216)
    	at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:209)
    	at org.springframework.integration.scheduling.SimpleTaskScheduler$ErrorHandlingRunnableWrapper.run(SimpleTaskScheduler.java:307)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
    	at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    	at org.springframework.integration.scheduling.SimpleTaskScheduler$TriggeredTask.run(SimpleTaskScheduler.java:256)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: javax.jms.JMSException: MQJMS2002: failed to get message from MQ queue
    	at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:595)
    	at com.ibm.mq.jms.MQMessageConsumer.getMessage(MQMessageConsumer.java:3710)
    	at com.ibm.mq.jms.MQMessageConsumer.receiveInternal(MQMessageConsumer.java:2863)
    	at com.ibm.mq.jms.MQMessageConsumer.receive(MQMessageConsumer.java:2619)
    	at org.springframework.jms.connection.CachedMessageConsumer.receive(CachedMessageConsumer.java:70)
    	at org.springframework.jms.core.JmsTemplate.doReceive(JmsTemplate.java:755)
    	at org.springframework.jms.core.JmsTemplate.doReceive(JmsTemplate.java:727)
    	at org.springframework.jms.core.JmsTemplate$10.doInJms(JmsTemplate.java:711)
    	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)
    	... 17 more
    My question is: how to have the connection recreated when error occurs? Or am i using CachingConnectionFactoy with the wrong way?
    Last edited by joule.qiao; Aug 9th, 2010, 05:37 AM.

  • #2
    Can the connection be re-tried

    Is there a means in which the connection can be re-tried, just like JDBC connections. I am also facing the same issue. I am quite sure it is not there, but in case I am missing something.

    Regards,
    Franklin

    Comment


    • #3
      Please post your question to the appropriate sections of this forum (e.g., JMS, Core Spring etc.).
      This particular forum is for questions related to Spring Integration framework, not general questions of integration with Spring.

      Comment


      • #4
        Honestly, I have tried that out

        http://forum.springsource.org/showthread.php?t=80265

        However, since someone got the same error here recently, I thought he might have rectified it somehow and hence the post.

        Having said that, I shall keep this in mind next time.

        Thanks & Regards,
        Franklin

        Comment

        Working...
        X