I have a problem with the FullAjaxExceptionHandler on ajax requests using the Omnifaces.
- Environment:
- Tomcat 7.0.50
- Mojarra 2.1.27
- Omnifaces 1.7
I declared the error pages in my web.xml:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error/errorPage.jsf</location>
</error-page>
<filter>
<filter-name>facesExceptionFilter</filter-name>
<filter-class>org.omnifaces.filter.FacesExceptionFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>facesExceptionFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
And I declared the exception handler on faces-config.xml
<factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>
With this environment the error page is shown correctly when throw an exception on a @PostConstruct method on a non-ajax request.
When I throw an exception on an ajax request, the error page is not shown, but I see this log message.
FullAjaxExceptionHandler: An exception occurred during processing JSF ajax request. Error page '/error/errorPage.jsf' will be shown.
After a while, I see another log message and the browser opens the "hardcoded error page".
FullAjaxExceptionHandler: Well, another exception occurred during rendering error page '/error/erroPage.jsf'. Trying to render a hardcoded error page now.
javax.faces.FacesException: org.apache.jasper.JasperException: /error/errorPage.jspx (line: 11, column: 39) Attribute "xmlns:h" must be declared for element type "html".
It seems that the JSP is trying to render the JSF page.
If I change the error page declaration to:
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error/errorPage.jspx</location>
</error-page>
The ajax request redirects correctly to my page, but the non-ajax request doesn't redirect anymore to the error page.
So, is this a configuration problem, environment problem or a bug on Omnifaces?
Thanks in advance.