You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Martin Lichtin <li...@yahoo.com.INVALID> on 2014/08/14 16:24:27 UTC

After broker restart, forever seeing 'javax.jms.IllegalStateException: The Session is closed' exceptions

The situation I have is a Camel route with a timer: endpoint sending a JMS message every few seconds.
After stopping/starting the broker, the client does not seem to be able to recover and forever spits out 


2014-08-14 15:53:55,429 | WARN  | #39 - timer://brokerInfo | TimerConsumer                    | rg.apache.camel.util.CamelLogger  224 | 117 - org.apache.camel.camel-core - 2.12.4 | Error processing exchange. Exchange[Message: [Body is null]]. Caused by: [org.springframework.jms.IllegalStateException - The Session is closed; nested exception is javax.jms.IllegalStateException: The Session is closed]
org.springframework.jms.IllegalStateException: The Session is closed; nested exception is javax.jms.IllegalStateException: The Session is closed
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:279)[127:org.springframework.jms:3.2.4.RELEASE]
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)[127:org.springframework.jms:3.2.4.RELEASE]
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)[127:org.springframework.jms:3.2.4.RELEASE]
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:228)[128:org.apache.camel.camel-jms:2.12.4]
    at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:431)[128:org.apache.camel.camel-jms:2.12.4]
    at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:385)[128:org.apache.camel.camel-jms:2.12.4]
    at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:153)[128:org.apache.camel.camel-jms:2.12.4]
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:113)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:157)[117:org.apache.camel.camel-core:2.12.4]
    at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:68)[117:org.apache.camel.camel-core:2.12.4]
    at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_55]
    at java.util.TimerThread.run(Timer.java:505)[:1.7.0_55]
Caused by: javax.jms.IllegalStateException: The Session is closed
    at org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:767)[93:org.apache.activemq.activemq-osgi:5.10.0]
    at org.apache.activemq.ActiveMQSession.createQueue(ActiveMQSession.java:1265)[93:org.apache.activemq.activemq-osgi:5.10.0]
    at org.apache.activemq.jms.pool.PooledSession.createQueue(PooledSession.java:194)[93:org.apache.activemq.activemq-osgi:5.10.0]
    at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveQueue(DynamicDestinationResolver.java:101)[127:org.springframework.jms:3.2.4.RELEASE]
    at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveDestinationName(DynamicDestinationResolver.java:66)[127:org.springframework.jms:3.2.4.RELEASE]
    at org.springframework.jms.support.destination.JmsDestinationAccessor.resolveDestinationName(JmsDestinationAccessor.java:100)[127:org.springframework.jms:3.2.4.RELEASE]
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$000(JmsConfiguration.java:217)[128:org.apache.camel.camel-jms:2.12.4]
    at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJms(JmsConfiguration.java:230)[128:org.apache.camel.camel-jms:2.12.4]
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)[127:org.springframework.jms:3.2.4.RELEASE]
    ... 15 more



The setup I have (OSGI Blueprint):

    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="failover:(nio://127.0.0.1:61616)?maxReconnectAttempts=3&amp;startupMaxReconnectAttempts=3&amp;initialReconnectDelay=500" />
        <property name="alwaysSyncSend" value="true" />
    </bean>


    <bean id="pooledJmsConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
        <property name="connectionFactory" ref="jmsConnectionFactory" />
        <property name="maxConnections" value="20" />
        <property name="idleTimeout" value="0" />
    </bean>


    <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="connectionFactory" ref="pooledJmsConnectionFactory" />
        <property name="transacted" value="false" />
        <property name="cacheLevelName" value="CACHE_CONSUMER" />
        <property name="concurrentConsumers" value="2" />
        <property name="preserveMessageQos" value="true" />
        <property name="receiveTimeout" value="10000" />
    </bean>


    <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
        <property name="configuration" ref="jmsConfig" />
    </bean>


    <camelContext xmlns="http://camel.apache.org/schema/blueprint" 

        xsi:schemaLocation="http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd" id="myid">
        <route id="requestBrokerStats">
            <from uri="timer://brokerInfo?fixedRate=true&amp;period=10000" />
            <to uri="bean:myBean" />
            <to uri="jms:queue:ActiveMQ.Statistics.Broker?deliveryPersistent=false" />
        </route>
    </camelContext>


Any ideas why recovery does not seem to work?

Re: After broker restart, forever seeing 'javax.jms.IllegalStateException: The Session is closed' exceptions

Posted by khandelwalanuj <kh...@gmail.com>.
We have faced this issue with ActiveMQ-5.10, in our case: After broker
restart consumer does not seem to be able to recover and forever throws
below exception: 

[ 2014-12-19 00:00:06,176 [securityEventDataSubscriberContainer-4105] 
listener.DefaultMessageListenerContainer.handleListenerSetupFailure():842
WARN ]: Setup of JMS message listener invoker failed for destination
'topic://check.newSecurityPublish' - trying to recover. Cause:
org.apache.activemq.ConnectionFailedException: The JMS connection has
failed: Connection refused 


Please check this, is is some sort of race condition, which cannot be
reproducible. It happens sometime and get fixed after client side restart. 

Thanks,
Anuj



--
View this message in context: http://activemq.2283324.n4.nabble.com/After-broker-restart-forever-seeing-javax-jms-IllegalStateException-The-Session-is-closed-exceptions-tp4684560p4689159.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: After broker restart, forever seeing 'javax.jms.IllegalStateException: The Session is closed' exceptions

Posted by lichtin <li...@yahoo.com>.
It's been a while but I vaguely remember the issue was configuring a limited
number of "maxReconnectAttempts".

failover:(nio://127.0.0.1:61616)?maxReconnectAttempts=3&....

Even though this looks innocent and _should_ work fine, it seems to stop 
the "failover" transport from failing over and re-connecting.

Removing the "maxReconnectAttempts" option was the solution, if I remember
correctly.




--
View this message in context: http://activemq.2283324.n4.nabble.com/After-broker-restart-forever-seeing-javax-jms-IllegalStateException-The-Session-is-closed-exceptions-tp4684560p4693619.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: After broker restart, forever seeing 'javax.jms.IllegalStateException: The Session is closed' exceptions

Posted by Tim Bain <tb...@alumni.duke.edu>.
Are you (or Anuj) able to reproduce this reliably even to allow someone
else to recreate the problem?
On Mar 23, 2015 4:50 AM, "agentalpha" <yo...@gmail.com> wrote:

> I'm facing the same issue. Couldn't find any solution to this so far...
> Did anyone managed to find a solution for this problem?
> If yes, then please share it.
>
> Thanks,
>
> yogesh
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/After-broker-restart-forever-seeing-javax-jms-IllegalStateException-The-Session-is-closed-exceptions-tp4684560p4693605.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: After broker restart, forever seeing 'javax.jms.IllegalStateException: The Session is closed' exceptions

Posted by agentalpha <yo...@gmail.com>.
I'm facing the same issue. Couldn't find any solution to this so far...
Did anyone managed to find a solution for this problem?
If yes, then please share it.

Thanks,

yogesh



--
View this message in context: http://activemq.2283324.n4.nabble.com/After-broker-restart-forever-seeing-javax-jms-IllegalStateException-The-Session-is-closed-exceptions-tp4684560p4693605.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.