1 Reply Latest reply on Jan 9, 2003 10:45 AM by Roger Barney

    error-page null error

    alex Newbie

      Hi there

      It would appear that when I try to send an Exception to my error page, something called StandardWrapperValve catches it and sets the exception to null. Then my error.jsp page gets a null exception and throws its own NullPointerException.

      I have an error page referenced in web.xml like so:
      after the servlet, servlet-name and welcome-file-list.

      error.jsp has:
      <%@page errorPage="true"%>

      When a SecurityException is thrown, StandardWrapperValve catches the exception and prints out the StackTrace. It then seems to set the exception to null. Then my error.jsp page gets the exception, but it is now null, and so it throws a NullPointerException of its own.

      when I do:
      if (exception == null)
      System.out.println("exception is null");

      'exception is null' is printed out. Its when error.jsp tries exception.printStackTrace() that the error happens.

      Can anyone shed some light?


        • 1. Re: error-page null error
          Roger Barney Newbie

          If you look at the incoming request:
          Found attribute: javax.servlet.error.servlet_name
          Found attribute: javax.servlet.error.exception
          Found attribute: javax.servlet.error.message
          Found attribute: javax.servlet.error.exception_type
          Found attribute: javax.servlet.error.request_uri
          Found attribute: javax.servlet.error.status_code

          But the JSP code resolves the exception:
          Throwable exception = (Throwable) request.getAttribute("javax.servlet.jsp.jspException");

          Try using the value from the request.