Sep 11th, 2008, 12:00 PM
Tomcat overrides Spring 2.5.5 and ExceptionResolvers
it took me quite long to debug through the tomcat sources to find out, why my exceptionresolver is not working anymore (in one special case).
In Spring 2.5.5 there was added a functionality in org.springframework.web.util.WebUtils to expose the Exception as the servletspec 2.3 attributes (javax.servlet.error.exception)
Tomcat looks for this attribute and shows the tomcat error page.
Because of this our custom ExceptionResolver doesn't work anymore.
This Resolver returns a redirect view. Because the redirect view is not commiting the response the ErrorReportValve from tomcat sets its own errorpage.
This only happens because Spring is exposing the exception as the standard Attributs and after the redirectView the Response is not commited. So ErrorReportValve from tomcat is setting the errorstatus to 500 and puts its own errorpage in the response.
I guess i'm doing something wrong, because it seems stupid to have the ExceptionResolver mechanism being totally defeated (if the view is not commiting the response) in tomcat 6 since Spring 2.5.5.
So i'm wondering what to do?
As a workaround it would be nice to know how to commit the response manually? But a correct solution would be much nicer.
EDIT: after digging into it, this seems to be a problem in tomcat, cause the servletspec says, after sendRedirect the response should be considered commited. i guess i will look into this at the tomcat mailing lists too.
Last edited by squiddle; Sep 11th, 2008 at 01:55 PM.