1 Reply Latest reply on Sep 24, 2010 11:36 AM by Bernd Eckenfels

    Encounter ManagedConnection already destroyd when creating JMS session

    nie feng Newbie

      Hi 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 -->
          <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>


      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