7 Replies Latest reply on Mar 18, 2010 2:08 PM by BJ Chippindale

    Connections and Sessions being automatically closed

    Cristiano Monteiro Newbie

      Hi there, guys.

       

      In the JMS documentation, it's said to "Most clients will do all their messaging with a single connection". I'm sticking to this by implementing a singleton that contains the only connection in my code. It's got several controls for recreating it in case of failure and so on. But as soon as the app starts running, I start getting the errors on my log:

       

      Mar 16, 2010 6:06:56 PM org.hornetq.core.logging.impl.JULLogDelegate warn

      WARNING: I'm closing a JMS connection you left open. Please make sure you close all JMS connections explicitly before letting them go out of scope!

      Mar 16, 2010 6:06:56 PM org.hornetq.core.logging.impl.JULLogDelegate warn

      WARNING: The JMS connection you didn't close was created here:

      java.lang.Exception

      at org.hornetq.jms.client.HornetQConnection.<init>(HornetQConnection.java:150)

      at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:592)

      at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)

      at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:111)

      at br.com.predicta.jms.utils.JMSUtils.currentConnection(JMSUtils.java:91)

      at br.com.predicta.jms.pool.factory.PoolableSessionFactory.makeObject(PoolableSessionFactory.java:32)

      at br.com.predicta.jms.pool.factory.PoolableSessionFactory.makeObject(PoolableSessionFactory.java:11)

      at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)

      at br.com.predicta.jms.pool.JMSSessionPoolCommons.borrowObject(JMSSessionPoolCommons.java:30)

      at br.com.predicta.jms.concurrent.ProducerThread.sendMessage(ProducerThread.java:52)

      at br.com.predicta.jms.concurrent.ProducerThread.run(ProducerThread.java:40)

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

      at java.lang.Thread.run(Thread.java:619)

       

      What's going on here? Is there any way for me to set the connection not be closed by Hornet? It implies on all the other objects being invalidated as soon the connection is closed.

       

      Thanks!

       

      BTW, it happens also with sessions:

       

      Mar 16, 2010 6:07:05 PM org.hornetq.core.logging.impl.JULLogDelegate warn

      WARNING: I'm closing a core ClientSession you left open. Please make sure you close all ClientSessions explicitly before letting them go out of scope! 14338504

      Mar 16, 2010 6:07:05 PM org.hornetq.core.logging.impl.JULLogDelegate warn

      WARNING: The ClientSession you didn't close was created here:

      java.lang.Exception

      at org.hornetq.core.client.impl.DelegatingSession.<init>(DelegatingSession.java:92)

      at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:438)

      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1063)

      at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:790)

      at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:558)

      at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:602)

      at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)

      at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:111)

      at br.com.predicta.jms.utils.JMSUtils.currentConnection(JMSUtils.java:91)

      at br.com.predicta.jms.pool.factory.PoolableSessionFactory.makeObject(PoolableSessionFactory.java:32)

      at br.com.predicta.jms.pool.factory.PoolableSessionFactory.makeObject(PoolableSessionFactory.java:11)

      at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)

      at br.com.predicta.jms.pool.JMSSessionPoolCommons.borrowObject(JMSSessionPoolCommons.java:30)

      at br.com.predicta.jms.concurrent.ProducerThread.sendMessage(ProducerThread.java:52)

      at br.com.predicta.jms.concurrent.ProducerThread.run(ProducerThread.java:40)

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

      at java.lang.Thread.run(Thread.java:619)

       

      Message was edited by: Cristiano Monteiro