tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konrad Bernstein <>
Subject Re: pageContext.getException() always null
Date Tue, 07 Jun 2005 14:26:18 GMT
Seems to me like a pure Tomcat-issue.
Downloaded and tested a couple of TC versions (5.0.28, 5.0.30 beta).
Same result: pageContext.getException() always returns null.

I then built Tomcat on my own (via
and everything worked fine there.

Looking at the source of class PageContextImpl made clear, that
the version has changed. The new implementation of method getException()
now uses JspRuntimeLibrary.getThrowable(request) instead of

This comes down to returning the request attribute
"javax.servlet.error.exception" instead of "javax.servlet.jsp.jspException".

So, if you use code like

Throwable error = (Throwable)
instead of

you should be fine.

However, looks like a TC bug to me, that only occurs if you setup your
error pages by
the error-tag within web.xml (not by using the page directive
errorPage). pageContext.getException()
only returns what is saved under attribute
"javax.servlet.jsp.jspException". But this attribute is
not set, if you're throwing from a Servlet, for instance (as with Struts

Have fun,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message