users@glassfish.java.net

Re: Error Handling Problem

From: <glassfish_at_javadesktop.org>
Date: Mon, 18 Jun 2007 02:03:32 PDT

I'm writing on behalf on ser, he leaves for a vacation.

As he wrote we found this problem in Glassfish V2 b44 and b50.
And there was no this problem in b39.

The problem occurs when using JSF Web application.
I've made test application.
NullPointerException is thrown in managed bean's method.

As I understand the problem is that this exception is hidden deeply in exception stack:

type Exception report

message

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

exception

javax.servlet.ServletException: #{userBean.print}: java.lang.NullPointerException
root cause

javax.faces.FacesException: #{userBean.print}: java.lang.NullPointerException
root cause

javax.faces.el.EvaluationException: java.lang.NullPointerException
root cause

java.lang.NullPointerException

So this exception is only 4th in stack.
But container checks up only to 2nd level exception.

So
<error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/error.jsp</location>
</error-page>

is not caught but

<error-page>
<exception-type>javax.faces.FacesException</exception-type>
<location>/error.jsp</location>
</error-page>

is caught.
[Message sent by forum member 'hazurek' (hazurek)]

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