Javid Sch wrote:I use two general error-pages. But always second page (/errorPage.faces) works. What do you recommend to use for this?
The super exception class always takes over precedence, so you should not catch the java.lang.Exception. Instead, you should catch specific exceptions.
Haina Minawa wrote:The super exception class always takes over precedence...
Seetharaman Venkatasamy wrote:most specific match win!
I've seen both these statements, but they can't both be correct! I decided since I couldn't find a good clear answer googling, I'd try for myself. I created two Exception classes - a GenericException and a SpecificException as a subclass of the former. I then added this to my web.xml:
When I build a servlet that throws a SpecificException, the SpecificExceptionHandler.jsp is served with Tomcat 6.0. Same with Tomcat 5.5. If I reverse the entries in my web.xml, same thing - the more specific class is matched.
If that's any indicator of the spec (I hope it is), it looks like it favors the most specific exception class.
Basically it makes a pass through the list of handled error pages.
If it doesn't find a match, then it looks at the exception cause, and tries that for a match.
Because you have a matcher for "Exception" it stops there without looking at the cause.
If you didn't have the declaration there with java.lang.Exception, it would probably work as you were wanting it to.
I would suggest replacing
and see if that works for you.