I would like to display a custom error page when a specific user exception is thown (CustomException) and display the standard Tomcat error page (the HTTP Status 500 with stacktrace printed) if the exception is different.
So i added in my web.xml :
<error-page>
<error-code>404</error-code>
<location>/xhtml/commun/error.xhtml</location>
</error-page>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/xhtml/commun/expired.xhtml</location>
</error-page>
<error-page>
<exception-type>organization.CustomException</exception-type>
<location>/xhtml/commun/error.xhtml</location>
</error-page>
However, when an exception other than CustomException is encountered, the content on the navigator freeze (nothing happens on the client side), and i have this log on server side :
nov. 09, 2015 4:12:56 PM org.apache.catalina.core.StandardWrapperValve invoke GRAVE: "Servlet.service()" pour la servlet Faces Servlet a généré une exception java.lang.IllegalArgumentException: Either HTTP 500 or java.lang.Throwable error page is required in web.xml or web-fragment.xml. Neither was found.
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handleAjaxException(FullAjaxExceptionHandler.java:207)
at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handle(FullAjaxExceptionHandler.java:176)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Aucun commentaire:
Enregistrer un commentaire