Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
5.10.0
-
None
-
None
Description
There is a change in activemq-client in the receive method, where it does a checkClosed call that throws an IllegalStateException which is not supposed according to JMS spec. This causes camel-jms / spring jms to not shutdown nicely and causes the JMS listener to hang, and also other side-effects.
For example the camel example pojo messaging demonstrates that. Just start the example according to its readme, and then shutdown the JVM with ctrl + c, and it hangs
[Thu Aug 07 10:33:27 CEST 2014]; root of context hierarchy] 2014-08-07 10:33:42,965 [Thread-1 ] INFO SpringCamelContext - Apache Camel 2.14-SNAPSHOT (CamelContext: camel-1) is shutting down 2014-08-07 10:33:42,971 [sonnel.records]] WARN ultJmsMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'personnel.records' - trying to recover. Cause: The Consumer is closed javax.jms.IllegalStateException: The Consumer is closed at org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:861) at org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:618) at org.apache.activemq.jms.pool.PooledMessageConsumer.receive(PooledMessageConsumer.java:67) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:430) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:310) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1101) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1093) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:990) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) 2014-08-07 10:33:42,975 [Thread-1 ] DEBUG BeanComponent - Clearing BeanInfo cache[size=2, hits=0, misses=2, evicted=0] 2014-08-07 10:33:42,975 [sonnel.records]] ERROR ultJmsMessageListenerContainer - Could not refresh JMS Connection for destination 'personnel.records' - retrying in 5000 ms. Cause: null java.lang.NullPointerException at org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSharedConnection(AbstractJmsListeningContainer.java:392) at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:885) at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:861) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1012) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) 2014-08-07 10:33:42,975 [Thread-1 ] DEBUG TimerListenerManager - Removed TimerListener: org.apache.camel.management.mbean.ManagedCamelContext@2a2bc16
As you can see from this stacktrace there is a NPE error inside spring jms which causes it not to shutdown correctly also.