Hi Jan - Apparently this problem is fixed in Tomcat 5. Tomcat 4.1.30
has the following code which has the effect I outlined below (losing the
stack trace of the original exception). Yet another example of why it is
necessary to test a webapp on all versions of the platform it may be
deployed on. - Paul
} catch (JasperException ex) {
throw ex;
} catch (Exception ex) {
throw new JasperException(ex);
}
Jan Luehe wrote:
Hi Paul,
> When I throw a JspException from a custom tag the PageContext
> handlePageException() method wraps it in a ServletException
unless the JspException contains a root cause, in which case its root
cause it wrapped inside the ServletException.
The problem (fixed in Tomcat 5) is that this ServletException is later
wrapped AGAIN in the JasperException....
> and then Tomcat JspServletWrapper.service() wraps that in a
JasperException
> (which is also a ServletException). So the original exception is 3 deep
> and the stack trace of the original exception is not reported in the
log
> (and if there is no message, as with a NullPointerException, then there
> is not even a message about what happened). So there is little or no
> useful diagnostics. What is the rationale for this behavior? It seems
> like the service() method should not wrap a ServletException inside a
> JasperException.
Which version of the sources did you look at?
The Tomcat 5 version of JspServletWrapper.service(), which I attached,
has this code at the bottom:
} catch (ServletException ex) {
throw ex;
} catch (IOException ex) {
throw ex;
} catch (IllegalStateException ex) {
throw ex;
} catch (Exception ex) {
throw new JasperException(ex);
}
which wraps an exception inside a JasperException only if it is
neither of type ServletException, IOException, and
IllegalStateException.
Jan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com