Part of the spec says "if no error-page declaration containing an exception-type fits using the class-heirarchy match, and the exception thrown is a ServletException or subclass thereof, the container extracts the wrapped exception..." So supposing for a minute that Tomcat internals "ignore" any error-page that has exception-type 'ServletException', it would then proceed to unwrap the exception to get down to your DAOException. Which you've already proved that you *can* catch. I've successfully caught 'all other' exceptions (which I suppose must include ServletExceptions), by using one error-page declaration that catches <status-code>500</status-code>, and then multiple <exception-type>'s to catch more specific exception types.
This is all on TC5.0.28 (TC4.x seemed a bit flakey on exceptions and errorpages, but that could have been PEBKAC) > -----Original Message----- > From: Wendy Smoak [mailto:[EMAIL PROTECTED] > Sent: Friday, February 25, 2005 11:27 AM > To: Tomcat Users List > Subject: Trying to understand exceptions and <error-page> > > > With nothing configured for errors, I get a Tomcat error page: > > HTTP Status 500 - > type Exception report > message > description The server encountered an internal error () that > prevented it from fulfilling this request. exception > javax.servlet.ServletException: > org.xml.sax.SAXParseException: blah, blah... ... root cause > com.example.DAOException: org.xml.sax.SAXParseException: > blah, blah... ... Caused by: org.xml.sax.SAXParseException: > blah, blah... > > The code that causes it looks like this: > > try { > ... > } catch ( Exception ex ) { > throw new DAOException( ex ); > } > > Can someone explain why, if I put this in web.xml, > > <error-page> > <exception-type>javax.servlet.ServletException</exception-type> > <location>/WEB-INF/jsp/error/exception.jsp</location> > </error-page> > > it does NOT display the .jsp and instead shows the same thing > as above with all the stack traces? > > I also tried configuring it for java.lang.Exception, but no > luck there, either. > > I _can_ get a good error page if I configure it for the 'root > cause' DAOException, I'm just confused as to why I can't trap > the ServletException. > > Thank you, > Wendy Smoak http://wiki.wendysmoak.com/cgi-bin/wiki.pl?TomcatErrorPage > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]