1 Reply Latest reply on Feb 18, 2004 6:03 AM by adrian.brock

    No ManagedConnections available within configured blocking t

    jcprout

      I am developing a JMS application on JBoss. I have a Queue, which I post messages to, from a custom MBean, to be received by an MDB running in a J2EE application in the same JBoss server.

      My problem is that I can't close the JMS connections I use, even though i call close() on the JMS Session and Connection, so the system eventually runs out of JMS connections in its pool (I can see this with the jboss.jca.ManagedConnectionPool MBean, named JmsXA)

      Since I'm running in the MBean, I have to create a UserTransaction before I put a message on the queue, otherwise it complains about an invalid TransactionId. This works - don't know if it's relavent.

      My code is roughly this (- the exception handling):

      private QueueConnectionFactory qFactory = null;
      private QueueConnection qConnect = null;
      private QueueSession qSendSession = null;
      private QueueSender qSender = null;

      // Create a QueueSender

      InitialContext jndi = new InitialContext();
      qFactory = (QueueConnectionFactory)jndi.lookup(JMS_FACTORY);
      qConnect = qFactory.createQueueConnection();
      qSendSession = qConnect.createQueueSession(true, Session.AUTO_ACKNOWLEDGE); // transactional

      queue = (Queue)jndi.lookup("myQueueName");
      qSender = qSendSession.createSender(queue);

      // Use the sender

      // Close the session and connection

      if(qSender != null)qSender.close();
      if(qConnect != null)qConnect.close();

      Does anyone know what I have to do to release/destroy the connection? The connection pool MBean says that I haven't "destroyed" and connections, and 20 are in use when it runs out

      Thanks - John