Issue Details (XML | Word | Printable)

Key: GLASSFISH-11919
Type: Bug Bug
Status: Resolved Resolved
Resolution: Incomplete
Priority: Major Major
Assignee: Amy Roh
Reporter: arungupta
Votes: 0
Watchers: 0
Operations

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

<exception-type> and Default error page do not show the required behavior

Created: 17/May/10 10:36 AM   Updated: 20/May/10 10:48 PM   Resolved: 20/May/10 10:48 PM
Component/s: web_container
Affects Version/s: V3
Fix Version/s: 3.1

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive DefaultErrorPage.zip (18 kB) 17/May/10 10:38 AM - arungupta
2. Text File web-error-page-exception-type-mapping-web.war (4 kB) 17/May/10 10:56 AM - Amy Roh
3. Text File web-error-page-handling-for-error-web.war (7 kB) 17/May/10 11:27 AM - Amy Roh

Environment:

Operating System: All
Platform: All


Issuezilla Id: 11,919
Tags:
Participants: Amy Roh and arungupta


 Description  « Hide

Attached is a simple Servlet that throws "server.HelloException" from doGet. The correct <exception-
type> and <location> is mentioned in "web.xml" but the error page is not shown even though the
exception is displayed in the server log. Similarly, the default error page is not displayed even though the
exception is displayed in the log.



arungupta added a comment - 17/May/10 10:38 AM

Created an attachment (id=4359)
NetBeans project with Servlet


Amy Roh added a comment - 17/May/10 10:55 AM

Your web.xml has exception-type commented out?

<error-page>
<!-- error-code>404</error-code -->
<!-- exception-type>server.HelloException</exception-type -->
<location>/error-404.html</location>
</error-page>

I'm attaching our unit test which is testing this functionality.


Amy Roh added a comment - 17/May/10 10:56 AM

Created an attachment (id=4360)
working error-page-exception-type-mapping war file


Amy Roh added a comment - 17/May/10 11:27 AM

Created an attachment (id=4361)
Attaching a test case which throws an exception explicitly from a Servlet


Amy Roh added a comment - 17/May/10 12:07 PM

The culprit is the finally block with the HelloServlet. The servlet is
returning "HTTP/1.1 200" instead of "HTTP/1.1 500"because the printwriter is closed.

} finally { //out.close(); }

Remove out.close and the correct error page gets displayed.


arungupta added a comment - 17/May/10 01:18 PM

Excellent, that worked!

Will close the bug.