-->
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.  [ 2 posts ] 
Author Message
 Post subject: threadlocal problem on 9iAS
PostPosted: Wed Mar 24, 2004 12:33 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
hi all,
we have developped an app under tomcat with threadlocal strategy.
All works fine.
When we integrate it on 9IAS we get this

[code]
/**
* @see javax.servlet.Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/
public void doFilter(ServletRequest request,ServletResponse response, FilterChain chain) throws IOException,ServletException
{
if (hibernateHolder.get() != null) {
Session sess = (Session)hibernateHolder.get();
if (sess != null)
{
hibernateHolder.set(null);
try
{
sess.close();
}
catch (HibernateException ex) { throw new ServletException(ex); }
}

throw new IllegalStateException("A session is already associated with this thread!"
+ "Someone must have called getSession() outside of the context "
+ "of a servlet request.");
}
try
{
chain.doFilter(request, response);
}
finally
{
/* La session hibernate existe, elle a


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 26, 2004 10:20 am 
Senior
Senior

Joined: Wed Aug 27, 2003 4:08 am
Posts: 178
Location: Wiesbaden, Germany
did you checked that your filter is called only once per request?
( can happen in when you jas:include or whatever )
( placing some guard on request and verifying its presence helps )

and threads can be reused - so your threadlocal is not guaranted to be fresh and smelly....

_________________
Got new hibernate xdoclet plugin? http://www.sourceforge.net/projects/xdoclet-plugins/
... Momentan auf der Suche nach neuen Projekt ode Festanstellung....


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