Announcement Announcement Module
Collapse
No announcement yet.
How to reconnect after restart foreign JMS server ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to reconnect after restart foreign JMS server ?

    Hi,

    How to reconnect after restart foreign JMS server using JmsTemplate class?

    I have jmsConnector.xml :

    Code:
    	<bean id="pidJMSJndiTemplate" class="pl.bph.rafik.connector.JndiTemplate">	<!-- lazy-init="true"  -->
    		<property name="environment" >
    			<props>
    				<prop key="java.naming.provider.url">${jms.services.pidJMSJndiTemplate.jndi.url}</prop>
    				<prop key="java.naming.factory.initial">${jms.services.pidJMSJndiTemplate.jndi.factory}</prop>
    				<prop key="java.naming.security.principal">${jms.services.pidJMSJndiTemplate.jndi.principal}</prop>
    				<prop key="java.naming.security.credentials">${jms.services.pidJMSJndiTemplate.jndi.credentials}</prop>
    			</props>
    		</property>
    	</bean>
    	
    	<bean id="pidConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">	<!-- lazy-init="true"  -->
    		<property name="jndiTemplate" ref="pidJMSJndiTemplate"/>
    		<property name="jndiName" value="${jms.services.pidJMSJndiTemplate.jndi.connectionFactory}" />
    		<!--<property name="cache" value="false" />  -->
    	</bean>
    
    	<bean id="pidQueueDestination" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">	<!-- lazy-init="true"  -->
    		<property name="jndiTemplate" ref="pidJMSJndiTemplate"/>
    		<property name="jndiName" value="${jms.services.pidJMSJndiTemplate.jndi.queueDestination}"/>
    		<!--<property name="cache" value="false" />  -->
    	</bean>
    
    	<bean id="pidJmsTemplate" name="pidJmsTemplate" class="org.springframework.jms.core.JmsTemplate" lazy-init="true">	<!-- lazy-init="true"  -->
    		<property name="connectionFactory" ref="pidConnectionFactory"/>
    		<property name="defaultDestination" ref="pidQueueDestination"/>
    		<property name="receiveTimeout" value="${jms.services.pidJMSJndiTemplate.jndi.receiveTimeout}"/>
        </bean>
    My system put messages into JMS and when JMS become unavailable i received:

    Code:
    02-01-2013 15:52:34.109 INFO  [JmsManagerImpl]:{51line} - 'Rafik' - Error JMS sending - org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is weblogic.jms.common.JMSE
    xception: [JMSClientExceptions:055053]Error creating connection to the server: java.rmi.ConnectException: This RJVM has already been shutdown 548676333052254974S:119.0.146.44:[7003,7003,-1,-1,7003,-1,-1,0,0]:119.0.146.44:7002,119.0.146.44
    :7003,119.0.146.45:7002,119.0.146.45:7003,119.0.146.46:7002,119.0.146.46:7003:NetDomain:pb4_03
    org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is weblogic.jms.common.JMSException: [JMSClientExceptions:055053]Error creating connection to the server: java.rmi.
    ConnectException: This RJVM has already been shutdown 548676333052254974S:119.0.146.44:[7003,7003,-1,-1,7003,-1,-1,0,0]:119.0.146.44:7002,119.0.146.44:7003,119.0.146.45:7002,119.0.146.45:7003,119.0.146.46:7002,119.0.146.46:7003:Ne
    tDomain:pb4_03
            at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
            at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
            at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)
            at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:534)
            at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:612)
            at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:604)
            at pl.bph.rafik.managers.impl.JmsManagerImpl.generateMessages(JmsManagerImpl.java:45)
            at pl.bph.rafik.jobs.rejectedtransactions.writer.RejectedTransactionsSendNotificationWriter.write(RejectedTransactionsSendNotificationWriter.java:68)
            at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:171)
            at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:150)
            at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:269)
            at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:194)
            at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:74)
            at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
            at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
            at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
            at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:258)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: weblogic.jms.common.JMSException: [JMSClientExceptions:055053]Error creating connection to the server: java.rmi.ConnectException: This RJVM has already been shutdown 548676333052254974S:119.0.146.44:[7003,7003,-1,-1,7003,-1,-1,
    0,0]:119.0.146.44:7002,119.0.146.44:7003,119.0.146.45:7002,119.0.146.45:7003,119.0.146.46:7002,119.0.146.46:7003:NetDomain:pb4_03
            at weblogic.jms.client.JMSConnectionFactory.setupJMSConnection(JMSConnectionFactory.java:258)
            at weblogic.jms.client.JMSConnectionFactory.createConnectionInternal(JMSConnectionFactory.java:285)
            at weblogic.jms.client.JMSConnectionFactory.createConnection(JMSConnectionFactory.java:191)
            at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
            at org.springframework.jms.core.JmsTemplate.access$0(JmsTemplate.java:1)
            at org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createConnection(JmsTemplate.java:1031)
            at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:297)
            at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:453)
            at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:540)
            at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:604)
            at pl.bph.rafik.managers.impl.JmsManagerImpl.generateMessages(JmsManagerImpl.java:46)
            at pl.bph.rafik.jobs.rejectedtransactions.writer.RejectedTransactionsSendNotificationWriter.write(RejectedTransactionsSendNotificationWriter.java:68)
            at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:194)
            at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
            at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
            at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
            at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:258)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:887)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:909)
    My system coudn't reconnect automatically, so how can i do it? Now i have to restart my system and then connection is established:/

  • #2
    Sorry for not getting to this sooner.
    We are in the process of moving to StackOverflow for our forums.

    This question is probably a better candidate for StackOverflow, perhaps against the #spring-jms tag.

    If you do post it there, please reply here with the link.

    Thanks!

    Comment

    Working...
    X