users@glassfish.java.net

Re: web.xml error-page: How to prevent wrapping in ServletException

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Fri, 06 Aug 2010 14:29:46 -0700

I have tried the following web.xml:
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<error-page>
<exception-type>java.sql.SQLException</exception-type>
<location>/errorSQLException.jsp</location>
</error-page>
</web-app>

It is working fine. Are you using GlassFish v3?
Shing Wai Chan



On 8/6/10 12:40 PM, Dominik Dorn wrote:
> Hi,
>
> I throw exceptions within my servlets and want to use the error-page
> mechanism in web.xml
> However, every Exception I throw gets wrapped in a ServletException
> which then requires
> me to unwrap it in the error-page itself, making the multiple
> error-page entries in web.xml useless.
>
> Is there a way I can specify that certain or all exceptions are not
> wrapped within a ServletException
> so that the error-page mechanism in web.xml works as expected?
>
>
> Thanks,
> Dominik
>