Lingo JMS Producer无法自动重新连接到WLS JMS

时间:2012-09-24 06:55:17

标签: java jms spring-jms

我正在使用WLS 10.3.4.0作为我的JMS提供程序。我的应用程序使用Lingo和Spring Remoting配置生产者和消费者。我的制作人是org.logicblaze.lingo.jms.JmsProxyFactoryBean,而我的消费者是org.logicblaze.lingo.jms.JmsServiceExporterMessageListener。我已经为WLS上的生产者和消费者启用了自动重新连接。奇怪的是,我的所有消费者都会自动重新连接,但我的制作人似乎并没有。

我尝试配置javax.jms.ExceptionListeneronException方法重置连接。但是,一旦WLS JMS再次可用且生产者未重新连接,则永远不会触发异常监听器。但是当我尝试使用生产者发送消息时,我确实看到了多个LostServerException。这让我相信WLS首先没有通知连接工厂,关于重新连接。我尝试使用普通的javax.jms.ConnectionFactoryExceptionListenerorg.springframework.jms.connection.CachingConnectionFactoryExceptionListener

以下是相关代码:

CachingConnectionFactory配置

<bean id="cachedTestQueueConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory" ref="wlsQueueConnectionFactory" />
        <property name="sessionCacheSize" value="1"/>
    <property name="reconnectOnException" value="true" />
    <property name="exceptionListener" ref="exceptionListener" />
</bean>

<bean id="exceptionListener" class="com.test.ExceptionListenerTest">
    <property name="cachingConnectionFactory" ref="cachedTestQueueConnectionFactory"/>
</bean>

<bean name="myProducerConfig" class="org.logicblaze.lingo.jms.JmsProducerConfig" lazy-init="true">
  <property name="deliveryMode" value="2"/>
</bean>

在我的tomcat容器中的多个Web应用程序中使用的常见JNDI查找

<bean id="baseWlsJndiObjectFactory"
  class="com.test.common.jndi.BasicJndiObjectFactoryBean"
  abstract="true">
    <property name="initialContextFactory" value="weblogic.jndi.WLInitialContextFactory" />
    <property name="providerURL" value="t3://localhost:8001" /> 
</bean>

<bean id="wlsQueueConnectionFactory" parent="baseWlsJndiObjectFactory" lazy-init="true">
   <property name="expectedType" value="javax.jms.ConnectionFactory" />
   <property name="jndiName" value="MyQueueConnectionFactory" />
</bean>

<bean id="defaultJMSDestination" parent="baseTibcoJndiObjectFactory"
  abstract="true">
  <property name="expectedType" value="javax.jms.Destination" />
</bean>

<bean id="lingoMetadataStrategy"
    class="org.logicblaze.lingo.SimpleMetadataStrategy"
    lazy-init="true">
  <property name="oneWayForVoidMethods" value="true" />
</bean>

<bean id="defaultJMSTaskExecutorPool" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
    <property name="corePoolSize" value="25"/>
    <property name="keepAliveSeconds" value="5"/>
    <property name="queueCapacity" value="20"/>
    <property name="daemon" value="true"/>
</bean>

<bean id="baseMsgListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer" abstract="true">
    <property name="concurrentConsumers" value="1"/>
    <property name="maxConcurrentConsumers" value="1"/>
    <property name="taskExecutor" ref="defaultJMSTaskExecutorPool"/>
    <property name="connectionFactory" ref="wlsQueueConnectionFactory"/>
</bean>

我的制片人和消费者配置:

<bean id="myJMSDestination" class="com.test.common.jndi.BasicJndiObjectFactoryBean"
    parent="defaultJMSDestination" lazy-init="true">
    <property name="jndiName"
        value="queue.lingo.com.test.myqueue" />
</bean>

<bean id="myJMSProducer" class="org.logicblaze.lingo.jms.JmsProxyFactoryBean"
    depends-on="myJMSConsumer" lazy-init="true" destroy-method="destroy">
    <property name="serviceInterface"
        value="com.test.common.service.MyService" />
    <!--property name="connectionFactory" ref="wlsQueueConnectionFactory" /-->
    <property name="connectionFactory" ref="cachedTestQueueConnectionFactory" />
    <property name="destination" ref="myJMSDestination" />
    <property name="metadataStrategy" ref="lingoMetadataStrategy" />
    <property name="producerConfig" ref="myProducerConfig" />
</bean>


<bean id="myJMSConsumer"
    class="org.logicblaze.lingo.jms.JmsServiceExporterMessageListener"
    destroy-method="destroy">
    <property name="service" ref="myService" />
    <property name="serviceInterface"
        value="com.test.common.service.MyService" />
    <property name="connectionFactory" ref="wlsQueueConnectionFactory" />
</bean>

<bean id="myServiceMsgContainer" parent="baseMsgListenerContainer">
    <property name="messageListener" ref="myJMSConsumer"/>
    <property name="connectionFactory" ref="wlsQueueConnectionFactory"/>
    <property name="destination" ref="myJMSDestination"/>
    <property name="maxConcurrentConsumers" value="5"/>
</bean>

我的部分业务逻辑通过反射调用myService callProducer异步方法。

在重新启动WLS JMS并保持应用程序活动之后,我看到一系列消息"DefaultMessageListenerContainer - Successfully refreshed JMS Connection"。然后,当我尝试通过我的生产者发送消息时,我在tomcat日志中发现了一系列WLS jms异常。

    JmsClientInterceptor - Remote access error: ReflectiveMethodInvocation: public abstract void com.test.common.service.MyService.callProducer(com.test.common.context.ApplicationContext,java.io.Serializable); target is null
weblogic.jms.common.LostServerException: [JMSClientExceptions:055169]Network connection to server was lost.
    at weblogic.jms.client.JMSSession.checkClosed(JMSSession.java:4883)
    at weblogic.jms.client.JMSSession.createObjectMessage(JMSSession.java:1123)
    at weblogic.jms.client.WLSessionImpl.createObjectMessage(WLSessionImpl.java:634)
    at org.logicblaze.lingo.jms.marshall.DefaultMarshaller.createRequestMessage(DefaultMarshaller.java:60)
    at org.logicblaze.lingo.jms.JmsClientInterceptor.invoke(JmsClientInterceptor.java:139)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy59.callProducer(Unknown Source)


Caused by: weblogic.jms.common.LostServerException: server connection in state STATE_NO_RETRY
    at weblogic.jms.client.ReconnectController.attachReasonToException(ReconnectController.java:609)
    at weblogic.jms.client.ReconnectController.analyzeExceptionAndReconnect(ReconnectController.java:540)
    at weblogic.jms.client.ReconnectController.computeJMSSession(ReconnectController.java:630)
    at weblogic.jms.client.WLSessionImpl.createObjectMessage(WLSessionImpl.java:641)
    ... 35 more
Caused by: weblogic.jms.common.LostServerException: java.lang.Exception: weblogic.rjvm.PeerGoneException: ; nested exception is:
        java.io.EOFException
        at weblogic.jms.client.JMSConnection.dispatcherPeerGone(JMSConnection.java:1541)
        at weblogic.messaging.dispatcher.DispatcherWrapperState.run(DispatcherWrapperState.java:692)
        at weblogic.messaging.dispatcher.DispatcherWrapperState.timerExpired(DispatcherWrapperState.java:617)
        at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
        at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
Caused by: java.lang.Exception: weblogic.rjvm.PeerGoneException: ; nested exception is:
        java.io.EOFException
        at weblogic.messaging.dispatcher.DispatcherWrapperState.onDisconnect(DispatcherWrapperState.java:396)
        at weblogic.rjvm.RJVMImpl$DisconnectEventDeliverer.run(RJVMImpl.java:1654)
        ... 3 more
Caused by: weblogic.rjvm.PeerGoneException: ; nested exception is:
        java.io.EOFException
        at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
        at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
        at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
        at weblogic.jndi.internal.ServerNamingNode_1033_WLStub.lookup(Unknown Source)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:405)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
        at weblogic.rmi.cluster.BasicReplicaHandler.refreshReplicaList(BasicReplicaHandler.java:507)
        at weblogic.rmi.cluster.BasicReplicaHandler.failOver(BasicReplicaHandler.java:207)
        at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:264)
        at weblogic.jms.frontend.FEConnectionFactoryImpl_1030_WLStub.connectionCreateRequest(Unknown Source)
        at weblogic.jms.client.JMSConnectionFactory.setupJMSConnection(JMSConnectionFactory.java:224)
        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:188)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:209)
         at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:701)
        at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:683)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:835)
        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:662)
Caused by: java.io.EOFException
        at weblogic.rjvm.t3.MuxableSocketT3.endOfStream(MuxableSocketT3.java:338)
        at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.java:768)
        at weblogic.socket.SocketMuxer.deliverEndOfStream(SocketMuxer.java:702)
        at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:890)
        at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:830)
        at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:339)
        at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
        at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSharedConnection(AbstractJmsListeningContainer.java:197)
        at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:701)
        at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:683)    

任何想法的人?这个问题一直困扰着我一整天。

P.S - 相关代码对那些试图将WLS JMS与Spring应用程序客户端一起使用的人有所帮助。除了为生产者自动重新连接之外,我还有这种端到端的工作方式。

0 个答案:

没有答案