Weblogic JMS 客户端在长时间处理后尝试提交时抛出 DispatcherException

Weblogic JMS client throws DispatcherException when trying to commit after long processing

我正在为 WebLogic 11g (WebLogic Server 10.3.6.0) 开发 JMS 客户端。客户端基于 wlthint3client.jar 库。客户端使用异步 API(侦听器)从 JMS 队列中读取消息。客户端是多线程的并使用多个并行 JMS 消费者。

Weblogic JMS 服务器配置为 JMS 事务超时为 10 分钟,但我在提交超过 6 分钟的事务时遇到问题。只有当有许多长事务同时进行时才会发生这种情况。

这种情况提交是否失败并出现以下异常:

weblogic.jms.common.JMSException: weblogic.messaging.dispatcher.DispatcherException: java.rmi.RemoteException: Could not establish a connection with -6273788781435586093S:host:[7001,7001,-1,-1,-1,-1,-1]:domain:server, java.io.IOException: Bootstrap request to JVMID -6273788781435586093S:host:[7001,7001,-1,-1,-1,-1,-1]:domain:server got an error or timed out; nested exception is:
    java.io.IOException: Bootstrap request to JVMID -6273788781435586093S:host:[7001,7001,-1,-1,-1,-1,-1]:domain:server got an error or timed out; nested exception is:
    java.rmi.ConnectException: Could not establish a connection with -6273788781435586093S:host:[7001,7001,-1,-1,-1,-1,-1]:domain:server, java.io.IOException: Bootstrap request to JVMID -6273788781435586093S:host:[7001,7001,-1,-1,-1,-1,-1]:domain:server got an error or timed out; nested exception is:
    java.io.IOException: Bootstrap request to JVMID -6273788781435586093S:host:[7001,7001,-1,-1,-1,-1,-1]:domain:server got an error or timed out
    at weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:116)
    at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSyncNoTran(DispatcherAdapter.java:61)
    at weblogic.jms.client.JMSSession.commit(JMSSession.java:1224)
    at weblogic.jms.client.JMSSession.commit(JMSSession.java:1198)
    at weblogic.jms.client.WLSessionImpl.commit(WLSessionImpl.java:108)

其他一些观察:

所以问题的解决方案是在JVM 运行 客户端应用程序-Dweblogic.ThreadPoolSize=N+1 上设置一个属性,其中N 是客户端使用的异步侦听器的数量。

如果您将它设置为 N,并且收到 N 条消息并卡住超过 4 分钟,那么您的提交将失败并出现上述异常。

为什么?我想当所有侦听器线程都忙于处理传入消息时,没有人可以与服务器通信并保持连接有效。 Oracle documentation on T3 connection heartbeats:

证实了这一点

Any two Java programs with a valid T3 connection — such as two server instances, or a server instance and a Java client — use periodic point-to-point "heartbeats " to announce and determine continued availability [...]

The frequency with which a server instance issues heartbeats is determined by the heartbeat interval, which by default is 60 seconds.

The number of missed heartbeats from a peer that a server instance waits before deciding the peer is unavailable is determined by the heartbeat period, which by default, is 4. Hence, each server instance waits up to 240 seconds, or 4 minutes, with no messages—either heartbeats or other communication—from a peer before deciding that the peer is unreachable.

在另一个地方:

WebLogic client thread pools are configured differently than WebLogic server thread-pools, and are not self tuning. WebLogic clients have a specific thread pool that is used for handling incoming requests from the server, such as JMS MessageListener invocations. This pool can be configured via the command-line property:

-Dweblogic.ThreadPoolSize=n

enter link description here