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
Created attachment 2450 [details] a zip file containing a test case (web app)
The test case also fails with tomcat 4.1.8 (jakarta-tomcat-4.1.8-LE-jdk14)
The test case also fails with tomcat 4.1.9 (jakarta-tomcat-4.1.9-LE-jdk14)
Is there any information on this? Has anyone had success (or not had success) replicating the error?
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
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.
Created attachment 2919 [details] a zip file containing another test case
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.
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?
This works for me in the latest versions of TC4 and TC5.
The test case works as it should now. It's possible that it has been working for quite some time.