Ok so the place where the exception is thrown could be key. It happens when sending a message to the queue. So the flow is as follows...
Initially the shared connection and session are created.
Code:
[pool-1-thread-1] INFO - Established shared JMS Connection: com.ibm.mq.jms.MQQueueConnection@10d3f0d
[pool-1-thread-1] DEBUG - Created cached Session for mode 0: com.ibm.mq.jms.MQQueueSession@f449b8
[pool-1-thread-1] DEBUG - Created cached MessageProducer for destination [queue:///MyQueue]: com.ibm.mq.jms.MQQueueSender@d61aef
[pool-1-thread-1] DEBUG - Returned cached Session: com.ibm.mq.jms.MQQueueSession@f449b8
Subsequent jms calls use the cached session
Code:
[pool-1-thread-1] DEBUG - Found cached Session for mode 0: com.ibm.mq.jms.MQQueueSession@f449b8
[pool-1-thread-1] DEBUG - Found cached MessageProducer for destination [queue:///MyQueue]: com.ibm.mq.jms.MQQueueSender@d61aef
[pool-1-thread-1] DEBUG - Returned cached Session: com.ibm.mq.jms.MQQueueSession@f449b8
Now I take the queue down and try to send another message
Code:
[pool-1-thread-1] DEBUG - Found cached Session for mode 0: com.ibm.mq.jms.MQQueueSession@f449b8
[pool-1-thread-1] DEBUG - Found cached MessageProducer for destination [queue:///MyQueue]: com.ibm.mq.jms.MQQueueSender@d61aef
[pool-1-thread-1] DEBUG - Returned cached Session: com.ibm.mq.jms.MQQueueSession@f449b8
[pool-1-thread-1] ERROR - unable to send message with logging event
javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:622)
at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1827)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1139)
at org.springframework.jms.connection.CachedMessageProducer.send(CachedMessageProducer.java:121)
at com.web.jms.JmsSender.send(JmsSender.java:175)
......
......
......
I was hoping this would reset the connection so that when I restart the queue the application would re-establish a new connection. Unfortunately, it does not and I get the same thing on the next call because the underlying connection is somehow corrupt.
Code:
[pool-1-thread-1] DEBUG - Found cached Session for mode 0: com.ibm.mq.jms.MQQueueSession@f449b8
[pool-1-thread-1] DEBUG - Found cached MessageProducer for destination [queue:///MyQueue]: com.ibm.mq.jms.MQQueueSender@d61aef
[pool-1-thread-1] DEBUG - Returned cached Session: com.ibm.mq.jms.MQQueueSession@f449b8
[pool-1-thread-1] ERROR - unable to send message with logging event
javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:622)
at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1827)
at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1139)
at org.springframework.jms.connection.CachedMessageProducer.send(CachedMessageProducer.java:121)
at com.web.jms.JmsSender.send(JmsSender.java:175)
Does the exception listener only trigger if there is an exception creating the connection? From looking at the code, this will only happen the first time. Is there some way to reset the connection if a problem occurs for subsequent calls?
Thanks.