tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nadav Katz <nadav.k...@oracle.com>
Subject RE: JSP Exception object arriving null at error handler
Date Sun, 11 Sep 2011 11:06:09 GMT
Hi Bob, 
Thanks for the quick reply. Is there anywhere where I can find documentation for this? I'm
asking because I came across this behavior by chance when I got a NullPointerException in
logging code calling exception.getMessage().
Is it possible that I will come across this with other types of exceptions? Is my logging
code unusable?
Thanks,
Nadav
-----Original Message-----
From: Bob Hall [mailto:rfhall3@yahoo.com] 
Sent: Sunday, September 11, 2011 12:54 PM
To: Tomcat Users List
Subject: Re: JSP Exception object arriving null at error handler





________________________________
From: Nadav Katz <nadav.katz@oracle.com>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Sunday, September 11, 2011 2:11 AM
Subject: JSP Exception object arriving null at error handler

Hi,

I seem to be having a problem with the exception object attribute arriving null at the error
handeling jsp. 

Since I encountered this error in production, I recreated on a small project.

This is the web.xml error page entry: 

<error-page>

                                <error-code>404</error-code>

                                <location>/notFoundErrorPage.jsp</location>

</error-page>

 

This is notFoundError.jsp:

<%@ page isErrorPage="true" %>

<%@ page isELIgnored="false"%>

 

<%

        if(exception != null)

        {

                System.out.println("Exception is not Null, it's " + exception.toString());

        }

                  else

                  {

                                System.out.println("Exception
is Null!!");

                  }

%>

What am I doing wrong? 

====

Nadav,

There is no Exception in this case.

This example should work for you _and_ allow you to display the resource that was not found:

http://stackoverflow.com/questions/4948275/get-url-of-page-requested-that-caused-a-404

- Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message