I am not too sure on this, but it could be because runtime exceptions are
usually avoidable and perhaps therefore you need to deal with such errors
beforehand(higher up in the stack) and throw custom exceptions. It doesn't
sound like good coding standards(what you are doing anyway). If you are
using JSF you can use<from-outcome> to control views for user error to
redirect them to error page.
--------------------------------------------------
From: "bryan jacobs" <bryancjac...@hotmail.com>
Sent: Wednesday, May 12, 2010 12:56 AM
To: <users@tomcat.apache.org>
Subject: error-page exception-type subclasses of RuntimeException are not
handled
Tomcat Version: apache-tomcat-6.0.26
JDK: jdk1.6.0_19
OS: Windows XP Service Pack 2
I am using the <page-error> element in my web.xml with the
<exception-type> element which contains a subclass of RuntimeException.
When I subclass RuntimeException the <location> element which specifies my
error-page to land on in the event that exception is raised is not
displayed.
web.xml snippet:
<error-page>
<exception-type>org.lds.lua.directory.exception.LuaSecurityException</exception-type>
<location>/error.html</location>
</error-page>
Where LuaSecurityException extends RuntimeException
When my JAX-RS method throws the LuaSecurityException the error.html is
NOT displayed.
However, if I change the above configuration to:
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/error.html</location>
</error-page>
and have my class throw a RuntimeException then the error.html page is
displayed.
Finally if I change the web.xml to:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.html</location>
</error-page>
and my jax-rs class throws a LuaSecurityException extends RuntimeException
then my error.html is displayed.
What I would like to do is:
<error-page>
<exception-type>org.lds.lua.directory.exception.LuaSecurityException</exception-type>
<location>/error.html</location>
</error-page>
That way I can create various RuntimeException subclasses which are
appropriate for my application and handle them with specific error pages.
Any help would be appreciated.
If you need more information please let me know.
Bryan
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org