Encounter ManagedConnection already destroyd when creating JMS session
niefeng Sep 24, 2010 10:43 AMHi all,
I encountered the following exception when trying to create a JMS Session object.
javax.resource.spi.IllegalStateException: ManagedConnection already destroyd at org.jboss.resource.adapter.jms.JmsManagedConnection.getConnection(JmsManagedConnection.java:245) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:411) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849) at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.allocateConnection(JmsSessionFactoryImpl.java:390) at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createSession(JmsSessionFactoryImpl.java:370)
My code is as follow
Connection conn = (Connection)getConnection(jmsConfigProps, destName); Session session = conn.createSession(false,Session.AUTO_ACKNOWLEDGE); //<-- throw the above exception
There is total two nodes (node 1 (main node), node 2) in the cluster. In order to see how my application behave if the cluster failed, i simulated a node crash by killing the node 1(main node) in the cluster. In the node 2, i am observing the above mentioned exception.
The clustered is deployed in the Fedora box. The jboss i am using is Jboss AS 4.2.3, jre 150_20, DB is postgres 8.4.4. The JMS setup is a HA JMS. The following is my JMS XA configuration that is found in the ha-jndi-jms-ds.xml
<!-- JMS XA Resource adapter, use this to get transacted JMS in beans --> <tx-connection-factory> <jndi-name>JmsXA</jndi-name> <xa-transaction/> <rar-name>jms-ra.rar</rar-name> <track-connection-by-tx/> <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition> <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property> <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property> <max-pool-size>100</max-pool-size> <blocking-timeout-millis>400000</blocking-timeout-millis> <idle-timeout-minutes>2</idle-timeout-minutes> <no-tx-separate-pools/> <security-domain-and-application>JmsXARealm</security-domain-and-application> </tx-connection-factory>
My program flow is as follow
MD Bean receive the jms message
MD Bean process some logic
MD Bean delegate to the next handler via JMS (<-- this is the point where the above exception happen)
What could be the cause of the above exception? Is it possible to recover from such error?
Many thanks
Niefeng