[quote="baliukas"]Threads are pooled on webserver, probably you forget to set null to "hibernateHolder" at the end of request, do it in "finally" block.[/quote]
I've got this for my doFilter method:
[code] public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (hibernateHolder.get() != null) {
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 {
closeSession();
}
}[/code]
I thought that the doFilter handled all the session closing.
|