You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2015/06/03 22:41:40 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=14571615#comment-14571615 ] 

Timothy Bish commented on AMQ-5310:
-----------------------------------

Not sure it is really wrong for the client code to throw the javax.jms.IllegalStateException which is what it currently does as the definition of that exception is "This exception is thrown when a method is invoked at an illegal or inappropriate time" and it is an extension of JMSException so any catch handler expecting JMSException would work.  So in the cases where it is throwing that exception type it is probably ok.

As far as the receive calls go I'm not sure it must always return null or only when the receive has entered a blocking mode as the API states that it returns null when the consumer is "concurrently" closed which you could read as meaning that it throws an exception if called "after" the consumer has been closed.  

> 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: Dejan Bosanac
>             Fix For: 5.12.0
>
>         Attachments: amq-5310.patch
>
>
> 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.3.4#6332)