users@glassfish.java.net

Re: web.xml <error-page> <exception-type> - has anyone made it work?

From: <glassfish_at_javadesktop.org>
Date: Thu, 06 May 2010 04:39:14 PDT

Thanks for your replies. I get the default GlassFish HTTP 500 error page as follows:

HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: uk.co.sportquest.exceptions.SportQuestException
root cause

javax.faces.el.EvaluationException: uk.co.sportquest.exceptions.SportQuestException
root cause

uk.co.sportquest.exceptions.SportQuestException
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.
--------------------------------------------------------------------------------

It's as if the Faces Servlet is re-throwing my exception as a ServletException?. My
exception is declared as:

public class SportQuestException extends Exception { ... constructors... }

Just to test this functionality I added an h:commandButton to a JSF page which
calls a backing bean function which throws the exception

public String jpaAction() throws SportQuestException {
        throw new SportQuestException("hello");

If I add an <exception-type> entry to web.xml for the ServletException or EvaluationException (or error-code 500)
then my error page is successfully navigated to. This is looking like a JSF problem at the moment and I'll be happy to take this to the web-tier forum if this would be more appropriate, but I really can't get it working at present.

Thanks,
Brendan.
[Message sent by forum member 'healeyb']

http://forums.java.net/jive/thread.jspa?messageID=452366