-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Tomcat db pooling -- Hibernate is not releasing connections
PostPosted: Wed May 25, 2005 11:04 am 
Beginner
Beginner

Joined: Fri Mar 19, 2004 7:21 am
Posts: 20
Hi all,

I am running Tomcat 5.0.28 under windows with Hibernate 2.1.7. I am using the standard ThreadLocal HibernateUtil pattern. When I enable DBCP abandoned session logging under Tomcat I get large numbers of Hibernate sessions that were never closed. Is hibernate not cleaning up after itself properly and returning connections to the pool or is this something my code is supposed to do manually?

DBCP object created 2005-05-25 15:36:11 by the following code was never closed:
java.lang.Exception
at org.apache.commons.dbcp.AbandonedTrace.init(AbandonedTrace.java:96)
at org.apache.commons.dbcp.AbandonedTrace.<init>(AbandonedTrace.java:79)
at org.apache.commons.dbcp.DelegatingStatement.<init>(DelegatingStatement.java:60)
at org.apache.commons.dbcp.DelegatingPreparedStatement.<init>(DelegatingPreparedStatement.java:65)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:185)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:260)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:235)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:66)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:784)
at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:864)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1618)
at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:27)
at core.domain.persist.AdamAssetDAO.sqlFindAssets(AdamAssetDAO.java:774)


The ramifications are that under heavy load my database pool is exhausted and I get the following exception.

java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:756)


Regards,
Damon.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 1:44 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you have to close your session ;)

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 8:53 am 
Beginner
Beginner

Joined: Fri Mar 19, 2004 7:21 am
Posts: 20
Doh,
OK, that should have been obvious. Thanks alot!

Damon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.