Bug 11091 - Tomcat (4.1.7 - 4.1.9)-LE-jdk14 ignores error page specified in web.xml
Summary: Tomcat (4.1.7 - 4.1.9)-LE-jdk14 ignores error page specified in web.xml
Status: CLOSED FIXED
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 4.1.10
Hardware: Other other
: P1 critical with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-23 15:45 UTC by Sean Reilly
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
a zip file containing a test case (web app) (723 bytes, application/octet-stream)
2002-07-23 15:46 UTC, Sean Reilly
Details
a zip file containing another test case (1.14 KB, application/octet-stream)
2002-09-04 15:31 UTC, Sean Reilly
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Reilly 2002-07-23 15:45:12 UTC
I have created a simple test case to illustrate this bug.
The test case is a simple web application, with 2 jsp pages (Error.jsp and 
test.jsp) and a web.xml deployment descriptor.

Error.jsp is a simple one line jsp page ("This is the error page")
test.jsp does nothing but throw a javax.servlet.jsp.JspException.
web.xml has a /Error.jsp set as the designated error page for both 500 response 
codes and exceptions of type javax.servlet.jsp.JspException.

Under tomcat 4.0.3, the expected result occurs; when test.jsp is accessed the 
contents of the custom error page are returned instead.

However, under tomcat 4.1.7, with the exact same web-app a different result 
occurs.  When test.jsp is accessed, a generic apache error page is displayed 
instead of the custom error page that appears in v4.0.3
Comment 1 Sean Reilly 2002-07-23 15:46:08 UTC
Created attachment 2450 [details]
a zip file containing a test case (web app)
Comment 2 Sean Reilly 2002-07-26 19:51:03 UTC
The test case also fails with tomcat 4.1.8 (jakarta-tomcat-4.1.8-LE-jdk14)
Comment 3 Sean Reilly 2002-08-16 19:42:53 UTC
The test case also fails with tomcat 4.1.9 (jakarta-tomcat-4.1.9-LE-jdk14)
Comment 4 Sean Reilly 2002-08-22 20:11:06 UTC
Is there any information on this?
Has anyone had success (or not had success) replicating the error?
Comment 5 John Trollinger 2002-09-03 18:17:57 UTC
This bug seems to violate JSP 7.5.2 and only appears to happen with the 
javax.servlet.jsp.JspException I tried a java.lang.NumberFormatException and it 
worked fine
Comment 6 Sean Reilly 2002-09-04 15:30:01 UTC
I have an additional test case that may help to further isolate the problem.
I have created a simple HttpServlet that does nothing but throw a 
javax.servlet.ServletException.
In this situation, the custom error page is not displayed.  However, unlike the 
jsp test case, this test case does not work correctly in tomcat 4.0.3 either.
Comment 7 Sean Reilly 2002-09-04 15:31:23 UTC
Created attachment 2919 [details]
a zip file containing another test case
Comment 8 Sean Reilly 2002-09-04 15:37:40 UTC
Well, I feel a little sheepish....

Please disregard the previous test case (attachment #2919 [details]). I forgot to adjust 
web.xml to redirect javax.servlet.ServletException to a custom error page.  
Once I did that, everything worked properly.
Comment 9 Sean Reilly 2002-09-04 16:11:20 UTC
I found this by accident....
If the following stanza is added to web.xml in the first test case:

<error-page>
    <exception-type>javax.servlet.ServletException</exception-type>
    <location>/Error.jsp</location>
</error-page>

Then everything works as expected, and the error page is displayed.  Is 
JspException being wrapped in ServletException when it shouldn't?
Comment 10 Mark Thomas 2004-01-13 22:32:30 UTC
This works for me in the latest versions of TC4 and TC5.
Comment 11 Sean Reilly 2004-01-13 22:54:50 UTC
The test case works as it should now.  It's possible that it has been working 
for quite some time.