安慰-当我收到“发送消息错误-已关闭”时如何自动重新连接

时间:2019-02-25 09:59:10

标签: solace

我的系统开始从solace API使用(sol-jms-10.1.1.jar)引发异常。重新启动应用程序后,问题消失了。我怀疑MQ在一个周末内进行了维护,然后连接发生了问题。

在这种情况下,我是否可以使用任何设置来自动断开断开的连接并重新连接以解决问题,而不必重新启动应用程序?

javax.jms.IllegalStateException: Error sending message - already closed (Tried to perform operation on a closed XML message producer)
    at sun.reflect.GeneratedConstructorAccessor677.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.solacesystems.jms.impl.JMSExceptionValue.newInstance(JMSExceptionValue.java:32)
    at com.solacesystems.jms.impl.JCSMPExceptionMapper$ArrayListMapper.get(JCSMPExceptionMapper.java:31)
    at com.solacesystems.jms.impl.JCSMPExceptionMapper.get(JCSMPExceptionMapper.java:94)
    at com.solacesystems.jms.impl.Validator.createJMSException(Validator.java:572)
    at com.solacesystems.jms.SolMessageProducer.sendMessage(SolMessageProducer.java:387)
    at com.solacesystems.jms.SolMessageProducer.send(SolMessageProducer.java:199)
...

Caused by: com.solacesystems.jcsmp.StaleSessionException: Tried to perform operation on a closed XML message producer
    at com.solacesystems.jcsmp.impl.JCSMPXMLMessageProducer.throwClosedException(JCSMPXMLMessageProducer.java:1434)
    at com.solacesystems.jcsmp.impl.JCSMPXMLMessageProducer.createBytesXMLMessage(JCSMPXMLMessageProducer.java:1864)
    at com.solacesystems.jcsmp.impl.JCSMPXMLMessageProducer.createXMLContentMessage(JCSMPXMLMessageProducer.java:1949)
    at com.solacesystems.jms.impl.FlowMessageProducerAdapter.createXMLContentMessage(FlowMessageProducerAdapter.java:85)
    at com.solacesystems.jms.encoding.DefaultJMSEncoder.encode(DefaultJMSEncoder.java:80)
    at com.solacesystems.jms.SolMessageProducer.sendMessage(SolMessageProducer.java:377)
    ... 27 more
Caused by: com.solacesystems.jcsmp.JCSMPTransportException: (JCSMPTransportException) Error receiving data from underlying connection.
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel$ClientChannelReconnect.call(TcpClientChannel.java:2257)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    ... 3 more
Caused by: ((Client name: myurl   Local addr: ...  Remote addr: ...) - )  com.solacesystems.jcsmp.JCSMPErrorResponseException: 403: Replication Is Standby [Subcode:56]
    at com.solacesystems.jcsmp.protocol.impl.TcpChannel.executePostOnce(TcpChannel.java:228)
    at com.solacesystems.jcsmp.protocol.impl.ChannelOpStrategyClient.performOpen(ChannelOpStrategyClient.java:90)
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.performOpenSingle(TcpClientChannel.java:414)
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.access$800(TcpClientChannel.java:104)
    at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel$ClientChannelReconnect.call(TcpClientChannel.java:2098)
    ... 4 more

1 个答案:

答案 0 :(得分:1)

连接断开后,Solace API能够自动重新连接。 此行为由“重新连接重试”属性控制。

详细信息可以在https://docs.solace.com/Solace-JMS-API/Managing-Sessions.htm#establishing_connections_577400906_329588的“重新连接重试”下找到

从例外情况来看,应用程序已经达到了Solace API放弃尝试重新连接的地步。 现在由应用程序来重新创建连接。