You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2014/08/07 10:50:12 UTC

[jira] [Commented] (AMQ-5310) activemq-client - Throws IllegalStateException in receive method which should be a JMSException

    [ https://issues.apache.org/jira/browse/AMQ-5310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14089012#comment-14089012 ] 

Claus Ibsen commented on AMQ-5310:
----------------------------------

The API on receive is
http://docs.oracle.com/javaee/6/api/javax/jms/MessageConsumer.html#receive(long)

Throws:
JMSException - if the JMS provider fails to receive the next message due to some internal error.

Though you can argue that if the consumer is closed is that an internal error? And should a runtime exception be thrown for other kind of exceptions?

Nevertheless we got a critical issue as camel-jms / spring jms / cannot shutdown reliably due changes in ActiveMQ.

> activemq-client - Throws IllegalStateException in receive method which should be a JMSException
> -----------------------------------------------------------------------------------------------
>
>                 Key: AMQ-5310
>                 URL: https://issues.apache.org/jira/browse/AMQ-5310
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.10.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Critical
>             Fix For: 5.11.0
>
>
> 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
> {code}
>  [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
> {code}
> As you can see from this stacktrace there is a NPE error inside spring jms which causes it not to shutdown correctly also.



--
This message was sent by Atlassian JIRA
(v6.2#6252)