You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Kurtz, Todd" <To...@Avnet.com> on 2002/08/16 20:14:01 UTC

Accessing the exception object

Thank you for any help you might provide.

I'm trying to figure out how/if Tomcat passes the exception object to a user
defined custom error page (given that the exception is already defined in
the
tomcat/conf/web.xml file).

So, my web.xml contains...
<error-page>
  <exception-type>org.apache.jasper.JasperException</exception-type>
 
<location>/error-pages/genexception.jsp?exceptionParam=JasperException</loca
tion>
</error-page>

And, my error page contains...
<%@ page isErrorPage="true" %>
<%= exception.getMessage() %>

I'm already catching error codes and exceptions this way, and allowing
tomcat
to forward to the custom error page, but the exception object itself is not
available; or, I don't know how to access the exception object from the
error
page. What I'm trying to do is print the stack trace to a log file. I'm
already
logging the fact that the exception was caught, I just need to figure out
how
to access the exception object from the error page.

So, here's a scenario...
1) I made a page that causes a JasperException to be thrown.
2) Via TOMCAT_HOME/conf/web.xml, tomcat sends the error page to the user.
3) The error page displays but the exception is null.

If tomcat doesn't forward the exception object automatically, then how do I
do this?


The common solutions I saw were 
1) forward from the error generating page to the error page. I don't want to
do
this because I have too many pages to touch.
2) define error pages in the web.xml file <error-page>, and specifically for
my
case use <error-type>...SomeTypeOfException</error-type>.

Option 2) is the approach that I'm trying to figure out. The forwarding
works, but
not the exception object.

Any help at all is greatly appreciated.

Regards,
Todd Kurtz

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>