My application uses JSF 2.0.6 and RichFaces 4.1.0. I implemented an ExceptionHandler which normally displays all exception in popup windows, and is working fine.
But something goes wrong when I disable partial state saving with this context param:
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
Or this one:
<context-param>
<param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>
<param-value>/index.xhtml</param-value>
</context-param>
When the session is expired, any action I do in the application throws a NullPointerException :
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:96) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
I looked into RenderResponsePhase.java:96 and it corresponds to this:
ViewDeclarationLanguage vdl =
vh.getViewDeclarationLanguage(facesContext,
facesContext.getViewRoot().getViewId());
In fact, the viewRoot is null !
This never happens when the Partial state saving is enabled or if the session isn't expired.
I need to activate the full state saving option for some reasons but I don't know how to handle correctly errors when the session is expired. I suppose this to be a JSF bug, and I'd like to fix it on my web app.
Additional information: Server: Tomcat 6.0.18