2

My system started throwing exceptions from the solace API use (sol-jms-10.1.1.jar). After restarting the application the problem went away. I suspect the MQ underwent maintenance over a weekend and then something happened to the connection.

Is there any setting I can use to automatically drop a broken connection and reconnect to fix the issue rather than having to bounce the application under this scenario?

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
Bruce Lowe
  • 6,063
  • 1
  • 36
  • 47

1 Answers1

1

The Solace API is able to automatically reconnect after a connection goes down. This behavior is controlled by the "Reconnect Retries" property.

Details can be found under "Reconnect Retries" at https://docs.solace.com/Solace-JMS-API/Managing-Sessions.htm#establishing_connections_577400906_329588

From the exception, the application has reached the point whereby the Solace API has given up attempting to reconnect. It is now up to the application to recreate the connection.

Russell Sim
  • 1,693
  • 2
  • 14
  • 22
  • "the Solace API has given up attempting to reconnect. It is now up to the application to recreate the connection." - I was hoping the app would not need to recreate a connection, why does the solace API not just do that? I am putting this solution in place now, but was hoping the driver would be more resilient than me having to try / catch recreate the connection. – Bruce Lowe Feb 26 '19 at 09:43
  • Because all of the configured "Reconnect Retries" has been exhausted. – Russell Sim Feb 27 '19 at 01:04
  • From the link in the answer: "A value of –1 specifies an unlimited number of reconnect retires is allowed". So if you want the API to keep reconnecting under the hood indefinitely, set the Reconnect Retries property to -1. – Szocske Mar 11 '19 at 15:52