glassfish
  1. glassfish
  2. GLASSFISH-11919

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: V3
    • Fix Version/s: 3.1
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      11,919

      Description

      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.

        Activity

        Hide
        arungupta added a comment -

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

        Show
        arungupta added a comment - Created an attachment (id=4359) NetBeans project with Servlet
        Hide
        Amy Roh added a comment -

        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.

        Show
        Amy Roh added a comment - 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.
        Hide
        Amy Roh added a comment -

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

        Show
        Amy Roh added a comment - Created an attachment (id=4360) working error-page-exception-type-mapping war file
        Hide
        Amy Roh added a comment -

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

        Show
        Amy Roh added a comment - Created an attachment (id=4361) Attaching a test case which throws an exception explicitly from a Servlet
        Hide
        Amy Roh added a comment -

        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.

        Show
        Amy Roh added a comment - 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.
        Hide
        arungupta added a comment -

        Excellent, that worked!

        Will close the bug.

        Show
        arungupta added a comment - Excellent, that worked! Will close the bug.

          People

          • Assignee:
            Amy Roh
            Reporter:
            arungupta
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: