If my JMS server is running (and continues to run) before I start Tomcat, everything is OK. But if the JMS server goes down my application stops working even after the JMS server goes back up.
Here is the exception I get:
15:36:35,671 WARN MessageService - JMSException while posting status:
org.jboss.mq.SpyJMSException: Cannot send a message to the JMS server; -
nested throwable: (java.net.SocketException: Connection reset by peer:
socket write error)
org.jboss.mq.SpyJMSException: Cannot send a message to the JMS server; -
nested throwable: (java.net.SocketException: Connection reset by peer:
socket write error)
at org.jboss.mq.Connection.sendToServer(Connection.java:1127)
at org.jboss.mq.SpySession.sendMessage(SpySession.java:562)
at
org.jboss.mq.SpyTopicPublisher.internalPublish(SpyTopicPublisher.java:12
0)
at
org.jboss.mq.SpyTopicPublisher.publish(SpyTopicPublisher.java:68)
at
org.apache.commons.messenger.MessengerSupport.send(MessengerSupport.java
:138)
at
com.idtect.detector.message.MessageService.postStatus(MessageService.jav
a:62)
at
com.idtect.detector.message.MessageService$myTask.run(MessageService.jav
a:101)
at java.util.TimerThread.mainLoop(Timer.java:432)
at java.util.TimerThread.run(Timer.java:382)
Caused by: java.net.SocketException: Connection reset by peer: socket
write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
at
java.io.BufferedOutputStream.write(BufferedOutputStream.java:108)
at
java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStrea
m.java:1637)
at
java.io.ObjectOutputStream$BlockDataOutputStream.writeByte(ObjectOutputS
tream.java:1675)
at
java.io.ObjectOutputStream.writeByte(ObjectOutputStream.java:684)
at
org.jboss.mq.il.oil.OILServerIL.addMessage(OILServerIL.java:217)
at org.jboss.mq.Connection.sendToServer(Connection.java:1119)
... 8 more
The client needs to install an exception listener
on the connection and handle the error itself.
Probably by retrying to connect at regular
intervals.
Regards,
Adrian