• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error-page precedence

 
Todd Farmer
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to set up several error-handling pages on Tomcat 5.0. The first error page captures java.lang.ArithmeticExceptions:



When implemented by itself, this works fine when I performa division by zero. However, when I add a more generic error-page, this generic error-page gets invoked rather than the page designed to catch ArithmeticExceptions:



I've tried changing the order of the <error-page> elements in the web.xml, but that doesn't affect behavior. The code that throws ArithmeticExceptions gets caught in the generic error-page, regardless of the listed order in the web.xml document.

Is there any way to control this? I have to assume there is. I want to have a generic error-handling template so that end users don't ever see raw error info from Tomcat, but I also want to catch specific errors (say, database connectivity errors) in specific templates.

Todd Farmer
 
chowdary Thammineedi
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it because everything propagated from a JSP page (I mean all errors) are wrapped in a Throwable?

Somebody, please clarify.

The servlet spec says the container has to choose the closest match (Interstingly, NOT the EXACT match) while going through the error-pages listed in the DD. If it could not find anythig that matches, it can "UNWRAP" the error or the exception and make another sweep through the error pages declared in the DD.

NOTE: This is not the exact quote from the spec. But equal to it.

But this is only in the Servlet 2.4 spec. I did not find it anywhere in the JSP spec.

Is every exception or error that is propagated out of a JSP Page wrapped in a Throwable? and is the matching done for the Throwable on the first pass?

Any and every explanation is welcome. How can we test this thing?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic