On 2/3/06, Mott Leroy <[EMAIL PROTECTED]> wrote:
> Sorry, there was a thread about jsp errors, but i thought this was
> different enough to warrant a new thread.
>
> I'm having trouble programatically retrieving the root cause of a JSP
> Exception. Basically, if a NullPointerException is thrown on a JSP page,
> I want to know that this exception was thrown and report it. I defined
> an error page in my web.xml:
>
>     <error-page>
>          <error-code>500</error-code>
>          <location>/error_pages/error.jsp</location>
>      </error-page>
>
> Then I created the error.jsp page, with <%@ page isErrorPage="true" %>
>
> Now, however, when i purposefully throw a NullPointerException from
> another page, my error.jsp seems unable to programatically access this
> stack trace.
>
> The "exception" implicit variable on this page is a "JasperException",
> which surprises me because the JSP 2.0 Spec (1.4.3) says that the
> exception should be of type javax.servlet.error.exception or
> javax.servlet.jsp.jspException. Doesn't seem like either is the case.
>
> The JasperException's stack trace isn't useful to report and there
> doesn't seem to be a "getRootCause" method on a JasperException like
> there is for a JspException.
>
> How can I retrieve the root cause?
>
> The default 500 error page provided by Tomcat prints out both the
> JasperException as well as the root cause, so it seems like this should
> be possible.
>
> Any help is much appreciated. Thanks.
>
> - Mott
>
> [tomcat 5.0.28]
>

JasperException is a subclass of Exception, so you should be able to
use the usual Exception methods on it. But it's not a
NullPointerException. JasperException is what I get if I mess up the
syntax in a JSP page. So, check for that.

--
Len

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to