Currently the JMS transport has a major limitation that if the broker is off-line the JMS polling task will repetitively throws the following exception[0] (which is the correct behaviour), how ever even after the broker becomes available the JMS listener keeps on throwing exception without re-connect. This can be a problem when we use the JMS transport in production. MessageListenerTask implements onException method but it doesn't seems to be getting triggered in case of broke goes offline. I have fixed the problem by catching the exception at ServiceTaskManager#receiveMessage() and re-scheduling another pooling task. When the JMS listener detects a connection refused error it'll throw an AxisJMSConnectionRefused exception. I have attached a patch, please review that and do let me know if we can fix this problem in a better way.
Rajika
[0] -
2011-04-05 10:08:45,830 [-] [jms-Worker-18] ERROR ServiceTaskManager Error
acquiring a JMS connection to : QueueConnectionFactory using JNDI properties
:
{java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory,
java.naming.provider.url=tcp://localhost:61616,
interface=SimpleStockQuoteServicePortType,
transport.jms.ConnectionFactoryType=queue, serviceType=proxy}
javax.jms.JMSException: Could not connect to broker URL:
tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:280)
at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:224)
at
org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:172)
at
org.apache.axis2.transport.jms.JMSUtils.createConnection(JMSUtils.java:554)
at
org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.createConnection(ServiceTaskManager.java:809)
at
org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.getConnection(ServiceTaskManager.java:691)
at
org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.receiveMessage(ServiceTaskManager.java:489)
at
org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:414)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at
org.apache.activemq.transport.tcp.TcpTransport.connect(TcpTransport.java:435)
at
org.apache.activemq.transport.tcp.TcpTransport.doStart(TcpTransport.java:401)
at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:53)
at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:57)
at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:57)
at
org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:72)
at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:57)
at
org.apache.activemq.transport.TransportFilter.start(TransportFilter.java:57)
at
org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:260)
... 11 more
jms-re-connect.patch
Description: Binary data
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
