Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When SimpleMessageListenerContainer could not connect, it throws a NullPointerException in shutdown() [SPR-9930] #14563

spring-projects-issues opened this issue Oct 30, 2012 · 0 comments
in: messaging type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Oct 30, 2012

Geert Pante opened SPR-9930 and commented

When I start a simpleMessageListenerContainer while the ActiveMQ server is down, I get:

to perform GET on: http://localhost:22012 as response was: Connection to http://localhost:22012 refused
        at org.apache.activemq.util.JMSExceptionSupport.create(
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(
        at org.apache.activemq.ActiveMQConnectionFactory.createConnection(
        at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(
        at org.springframework.jms.listener.AbstractJmsListeningContainer.establishSharedConnection(
        at org.springframework.jms.listener.SimpleMessageListenerContainer.doInitialize(

        at org.springframework.jms.listener.AbstractJmsListeningContainer.initialize(
        ... 10 more

I can catch this exception, and the container will keep retrying, which is a good thing.

If I want to shut it down, I do

    if (jmsContainer.isRunning())
    jmsContainer = null;
catch (JmsException e)
    log.warn("Exception stopping listener: ", e);

But here I get a NullPointerException from the destroy():

Caused by: java.lang.NullPointerException
        at org.springframework.jms.listener.SimpleMessageListenerContainer.doShutdown(
        at org.springframework.jms.listener.AbstractJmsListeningContainer.shutdown(
        at org.springframework.jms.listener.AbstractJmsListeningContainer.destroy(

Apparently, this.consumers and this.sessions are null, while you try to iterate over them.

Affects: 3.0.7

@spring-projects-issues spring-projects-issues added type: bug in: messaging labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.1.3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: messaging type: bug
None yet

No branches or pull requests

2 participants