Issue Details (XML | Word | Printable)

Key: SPR-4973
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: Gareth Davis
Votes: 0
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Spring Framework

2.5.5 DispatchServlet exposes jsp error page attributes to container and breaks ExceptionResolver

Created: 02/Jul/08 03:53 PM   Updated: 10/Feb/09 12:29 PM
Component/s: SpringWEB
Affects Version/s: 2.5.5
Fix Version/s: 2.5.6

Time Tracking:
Not Specified

File Attachments: 1. Java Source File StandardHostValve.java (16 kB)

Environment: Tomcat 5.5.23+ and tomcat 6.0.16 spring 2.5.5
Issue Links:
Related

Platform: Tomcat - 5.5


 Description  « Hide
The changes made SPR-4810 to expose jsp error page attributes actually breaks the use of exception resolver's in tomcat 5.5.17/5.5.23 and 6.0.16.

Once tomcat's StandardHostValue has invoked the servlet chain checks the request for the existence of "javax.servlet.error.exception" and if it's present it throws the response away and starts error page processing.

The net result is that views resolved by an ExceptionResolver running in tomcat will never actually be seen. I'm in the process of preparing a patch, I think the only practical solution is to remove the exposed error attributes at the end of doDispatch



 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Gareth Davis added a comment - 02/Jul/08 03:56 PM
Tomcat 6.0.16 implementation of StandardHostValue, see invoke(Request,Response)

Juergen Hoeller added a comment - 03/Jul/08 02:32 AM
Wouldn't it also work if we removed the Spring-exposed error attributes after we rendered the Spring error view - that is, before returning control to the servlet container?

Juergen


Juergen Hoeller added a comment - 03/Jul/08 08:58 AM
I've checked that removing those error-view-driven servlet request attributes after rendering does actually work on Tomcat (again). I've committed this for the next 2.5.6 snapshot (http://static.springframework.org/downloads/nightly/snapshot-download.php?project=SPR). Please give it an early try and let me know whether it works for you...

Juergen


Juergen Hoeller added a comment - 03/Jul/08 09:00 AM
BTW, the reason why this wasn't noticed during 2.5.5 pre-release testing (which includes running the sample applications on Tomcat) is that the PetClinic sample app has both a Spring-driven error view and a standard JSP error page in web.xml configured. The rendered error pages differ in their header message only, which is why it was easy to miss that it suddenly said "Internal error" (the web.xml error page) instead of e.g. "Data access error" (the more specific Spring-driven error view).

Juergen


Gareth Davis added a comment - 03/Jul/08 01:05 PM
That was the solution I was trying to suggest I'm still faffing about trying to build the source.

I'll check out the update tomorrow, thanks.

Gareth


Mike Bryan added a comment - 16/Sep/08 11:45 AM
I can confirm the update fixed the problem.

I ran into the same bug with 2.5.5. Updating to 2.5.6 build #615 made the problem go away.

Thanks!
--Mike


Matthew Sgarlata added a comment - 30/Sep/08 10:16 AM
I just ran into this problem and build 630 did the trick for me. Thanks for the fix!

For anyone who needs to pick up this fix, remember to get this fix you have to upgrade your spring-webmvc.jar, not just spring.jar


Kengkaj Sathianpantarit added a comment - 05/Nov/08 04:30 AM
I got this issue for many weeks, SimpleMappingExceptionResolver doesn't work. Thanks.

Thomas Koeppen added a comment - 05/Nov/08 05:08 AM
we got the same issue with dm-server (spring 2.5.5A, next version maybe with 2.5.6, which contains this fix)
as all exceptions were "translated" to error 500, we patched our local 2.5.5 with Jürgen's fix (thanks), otherwise Spring MVC was unusable for us.

Alex Seel added a comment - 26/Jan/09 06:51 AM
I'm find a related problem - please see last post:

[url]http://forum.springsource.org/showthread.php?p=223433#post223433[/url]

essentially: create controller, throw RuntimeException in handleRequest, in HandlerExceptionResolver just return ModelAndView page in resolveException.

Request is correctly routed but gives org.apache.catalina.core.StandardHostValve/IllegalStateException stack trace in logs.


Ivan Ushakov added a comment - 10/Feb/09 12:29 PM
I have a strange problem with SimpleMappingExceptionResolver. I configured it to catch any exception by setting java.lang.Exception.
If I trying to catch exception from Controller - it works fine. But if exception thrown from WebFlow handler - it shows me 500 status.
I also noticed that request attributes in first and second case distinguish by only one attribute:
org.springframework.web.servlet.HandlerMapping.pathWithinHandlerMapping=<someone URL>.

What is a problem? As I read in WebFlow documentation all unhandled exception go to Dispatcher. I tried to trace all calls and saw that Tomcat gets exception object from request and renders status 500 page.

Tomcat 6.0.18
WebFlow 2.0.5
Spring 2.5.5