filterConfig.getServletContext().getRequestDispatcher(destPath).forward(req,
res);
When doing this, however, I was getting this error with any code that
tried to touch Hibernate:
org.hibernate.HibernateException: No session currently bound to
execution context
Not a big surprise though, since my web.xml originally was just:
<filter-mapping>
<filter-name>sessionPerRequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Which means it's only binding to incoming requests, and if my other
filter is catching the request before then and then forwarding it,
Warp/Hibernate never got the change to initialize in the way it was
expected. So I figured the easy fix was:
<filter-mapping>
<filter-name>sessionPerRequestFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
Unfortunately - and this is where I'm stuck - I got this error:
org.hibernate.SessionException: Session was already closed
at org.hibernate.impl.SessionImpl.close(SessionImpl.java:275)
at com.wideplay.warp.hibernate.SessionPerRequestFilter.doFilter(SessionPerRequestFilter.java:56)
I figure it has something to do with the fact that
SessionPerRequestFilter is being "double processes" (once for the
request and once for the forward), but I'm not quite sure. I tried to
debug but couldn't get too far.
Any suggestions?
Patrick
--
On-demand, low-cost load testing using real browsers
http://browsermob.com
Patrick Lightbody
Founder, BrowserMob
+1 (415) 830-5488