1

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

我尝试使用重置连接javax.jms.ExceptionListener的方法配置一个。onException但是,一旦 WLS JMS 再次可用并且生产者未重新连接,则永远不会触发异常侦听器。LostServerException但是当我尝试使用生产者发送消息时,我确实看到了多个s。这让我相信 WLS 根本没有通知连接工厂,关于重新连接。我尝试过使用javax.jms.ConnectionFactory带有 noExceptionListenerorg.springframework.jms.connection.CachingConnectionFactorywith 的普通旧版本ExceptionListener

以下是相关代码:

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>

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

在我的应用程序保持活动状态的同时重新启动 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)    

有什么想法吗?这个问题已经挑战了我一整天。

PS - 相关代码将有助于那些尝试将 WLS JMS 与 Spring 应用程序客户端一起使用的人。除了生产者的自动重新连接外,我已经完成了端到端的工作。

4

0 回答 0