0

I have deployed an application in Tomcat7 to read messages from Foreign JMS Topic in Weblogic 11g. This is my spring application context xml. I have included wlthint3client.jar in my classpath.

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:c="http://www.springframework.org/schema/c"
 xmlns:p="http://www.springframework.org/schema/p"
 xmlns:jms="http://www.springframework.org/schema/jms"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.0.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

 <!-- Uncomment and add your base-package here: <context:component-scan base-package="org.springframework.samples.service"/> -->
 <tx:jta-transaction-manager/>
 <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager" p:connectionFactory-ref="clarifyconnectionFactory"/>
 <bean id="clarifyTopic" class="org.springframework.jndi.JndiObjectFactoryBean"
  p:jndiName="jms/ATomcatClarifyTopic"
  p:proxyInterface="javax.jms.Destination"
  p:jndiTemplate-ref="jndiTemplate"/>
 <bean id="messageAdapter" class="org.springframework.jms.listener.adapter.MessageListenerAdapter" p:defaultListenerMethod="receive">
 <constructor-arg>
  <bean class="com.jnpr.clarify.jms.DefaultTextMessageDelegate"/>
 </constructor-arg>
 </bean> 
 <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
  <property name="environment">
   <props>
    <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
    <prop key="java.naming.provider.url">t3://weblogichost:8001</prop>
   </props>
  </property>
 </bean>
 <!-- Lookup JMS Connection Factory -->
 <bean id="clarifyconnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"
  p:jndiName="jms/TestTopicConnectionFactory" p:proxyInterface="javax.jms.TopicConnectionFactory"
  p:jndiTemplate-ref="jndiTemplate"
  p:exposeAccessContext="true"/>

  <!-- Configuring JMS Template -->
 <bean id='jmsTemplate' class="org.springframework.jms.core.JmsTemplate"
  c:_0-ref="clarifyconnectionFactory" />

 <!-- Configuring Topic Listener -->
 <bean id="topicListener" class="com.jnpr.clarify.jms.TopicListener" />

 <!-- Configuring MessageListenerContainer -->
 <bean id="JMSMessageListenerContainer"
  class="org.springframework.jms.listener.DefaultMessageListenerContainer"
  p:destination-ref="clarifyTopic" p:connectionFactory-ref="clarifyconnectionFactory"
  p:messageListener-ref="messageAdapter" p:transactionManager-ref="jmsTransactionManager"
  p:durableSubscriptionName="TomcatClarify"/>
</beans>
  • In this i have used MessageListenerAdapter as JMS Listener. I have also tried witha a bean implementing javax.jms.MessageListener. But still getting same exception.
  • I am not using any transaction management in my code but still configured Transaction manager to check if that fixes the issue.
  • Am getting below exception in tomcat server log.

    WARNING: Setup of JMS message listener invoker failed for destination 'JUN_JMS_SOA_Module!ATomcatClarifyTopic' - trying to recover. Cause: [JMSClientExceptions:055142]Foreign destination, JMS_SOA_Module!TomcatClarifyTopic Jan 01, 2015 7:09:13 PM org.springframework.jms.listener.DefaultMessageListenerContainer refreshConnectionUntilSuccessful INFO: Successfully refreshed JMS Connection

Please help if am doing anything wrong.

Ramkumar
  • 65
  • 1
  • 1
  • 6

1 Answers1

0

The above code working when message listener container configured using jms namespace as below instead of regular spring bean.

<jms:listener-container container-type="default" acknowledge="auto"
 connection-factory="clarifyconnectionFactory" destination-type="durableTopic"
 destination-resolver="jmsDestinationResolver">
  <jms:listener destination="jms/ATomcatClarifyTopic" ref="topicListener"/>
 </jms:listener-container>  
 <bean id="jmsDestinationResolver"
        class="org.springframework.jms.support.destination.JndiDestinationResolver">
 <property name="jndiTemplate">
  <ref bean="jndiTemplate" />
 </property>
 <property name="cache">
  <value>true</value>
 </property>
 </bean>
Ramkumar
  • 65
  • 1
  • 1
  • 6