-->
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.  [ 5 posts ] 
Author Message
 Post subject: Finally isthere but finalizing unclosed session with closed
PostPosted: Fri Mar 12, 2004 6:38 pm 
Beginner
Beginner

Joined: Sat Nov 22, 2003 3:54 pm
Posts: 42
Hi,

We have this configuration for our webapp.

Hibernate 2.1
JBoss 3.2.3
Database - DB2

Datasource is managed by the App Server and Transactions are also managed by app server.

From web tier we pass the object graph to a Session bean which then delegates the request of saving to a DAO class which makes use of the Hibernate to do save operations.

In the DAO class we have "finally" clause for every methods which needs Hibernate Session, where we close the hibernate session and we also throw EJBException from Session bean so that transaction also gets roll back, but whenever any error occus in the DAO class while saving we can see this warning appearing.

----------------------------
WARN [SessionImpl] finalizing unclosed session with closed connection
-----------------------------

Also we make use of a static class to fetch the session and close the session.At the load of the class we have a static block that does a jndi lookup for the SessionFactory and stores it in a static variable thats available throughout the life cycle. We are making use of "ThreadLocal" way of fetching and closing the session.

What can be the possible reasons?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2004 8:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
finalize is not a good way to do this, it can't be relied upon. The JVM may handle this at very different points in the GC process.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2004 12:58 pm 
Beginner
Beginner

Joined: Sat Nov 22, 2003 3:54 pm
Posts: 42
Its not a "finalize", its a "finally" block of the "try/catch" block where the close session is called.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2004 2:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Ah damn, ignore my post :) Read to fast. I'd say you put in a bunch of logging/debugging to check where you loose a session without closing it.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2004 9:07 pm 
Beginner
Beginner

Joined: Sat Nov 22, 2003 3:54 pm
Posts: 42
Ah damm :) ignore my post too.. i was calling flush on the session in close session, so it itself threw an error when there was an error hence not closing the session...my bad guys..but thanks Michael for pointing me towards the log...

Cheers


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.