0 Replies Latest reply on May 13, 2005 11:31 AM by Robin Roos

    JBoss closes (jms) connections for me

    Robin Roos Newbie

      Hi Folks

      I have a session EJB which sends messages. In ejbCreate() I establish all the objects necessary to support publication of messages to a queue. i.e. I have the QueueSession and QueueSender objects.

      A "business method" of this session bean sends messages. This works for one invocation, after which JBoss kindly says:

      // 2005-05-13 14:44:57,802 INFO TP-Processor1 [org.jboss.resource.connectionmanager.CachedConnectionManager] Closing a connection for you. Please close them yourself: org.activemq.ra.JMSConnectionProxy@1b6484c
      at com.drkw.genesis.server.ejb.jmssender.JMSSenderBean.ejbCreate(JMSSenderBean.
      java:49)
      at com.drkw.genesis.server.ejb.jmssender.JMSSenderLocalDelegate.sendMessages(JM
      SSenderLocalDelegate.java:25)

      The next invocation gets:

      TE/1/4048514.0.1 2005-05-13 14:43:55,925 ERROR RMI TCP Connection(8)-10.131.55.92 [org.jboss.ejb.plugins.LogInterceptor]
      TransactionRolledbackLocalException in method: public abstract java.lang.String[] com.drkw.genesis.server.ejb.jmssender.JMSSenderLocal.sendMessages(java.lang.
      String[],java.lang.String), causedBy:
      javax.jms.IllegalStateException: The Session is closet com.drkw.genesis.server.ejb.jmssender.JMSSenderBean.ejbCreate(JMSSenderBean.
      java:49)
      at com.drkw.genesis.server.ejb.jmssender.JMSSenderLocalDelegate.sendMessages(JMSSenderLocalDelegate.java:25)
      at org.activemq.ra.JMSSessionProxy.getSession(JMSSessionProxy.java:95)
      at org.activemq.ra.JMSSessionProxy.createTextMessage(JMSSessionProxy.java:268)
      at org.activemq.ActiveMQQueueSession.createTextMessage(ActiveMQQueueSession.java:260)
      at com.drkw.genesis.server.ejb.jmssender.JMSSenderBean.send(JMSSenderBean.java:126)
      at com.drkw.genesis.server.ejb.jmssender.JMSSenderBean.sendMessages(JMSSenderBean.java:101)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      I really don't want to close the connection each time, since that means re-establishing the connection each time, but while JBoss is closing the connection for me I have no choice!

      The deployment of ActiveMQ is based on:

      <connection-factories>
      <tx-connection-factory>
      <jndi-name>JmsXA</jndi-name>
      <rar-name>activemq.rar</rar-name>
      <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
      <config-property name="ServerUrl" type="java.lang.String">tcp://localhost:61616</config-property>
      <config-property name="UseEmbeddedBroker" type="java.lang.Boolean">false</config-property>
      <security-domain-and-application>JmsXARealm</security-domain-and-application>
      </tx-connection-factory>
      <!-- ...queue definitions... -->
      </connection-factories>

      ActiveMQ 3.1-Snapshot, JBoss 4.0.1. All suggestions welcome.

      Thanks, Robin.