1 Reply Latest reply on Jan 6, 2019 5:26 AM by jaikiran

    WildFly 12.0.0 Final in EE8 mode: web.xml error handler for error-code 500 not entered

    tokada

      web.xml:

       

      <error-page>
        
      <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        
      <location>sessionex.xhtml</location>
      </error-page>

      <error-page>
        
      <error-code>500</error-code>
        
      <location>onerror.xhtml</location>
      </error-page>

       

      A thrown javax.faces.application.ViewExpiredException becomes a javax.servlet.ServletException and this one is not catched by the 500 error-code handler:

       

      2018-12-12 18:11:58,934 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /foobar/index.xhtml: javax.servlet.ServletException: viewId:/index.xhtml - ...
        at javax
      .faces.api//javax.faces.webapp.FacesServlet.service(FacesServlet.java:683)
      ...
      Caused by: javax.faces.application.ViewExpiredException: viewId:/index.xhtml - ...
        at com
      .sun.jsf-impl//com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:218)
        at com
      .sun.jsf-impl//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
        at com
      .sun.jsf-impl//com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:133)
        at com
      .sun.jsf-impl//com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
        at javax
      .faces.api//javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
        
      ...

       

      To catch the javax.servlet.ServletException I need

       

      <error-page>
        
      <exception-type>javax.servlet.ServletException</exception-type>
        
      <location>onerror.xhtml</location>
      </error-page>

       

      Summary:

       

      Problem 1: In case of javax.faces.application.ViewExpiredException the javax.faces.application.ViewExpiredException handler is not used and the exception becomes a javax.servlet.ServletException.

       

      Problem 2: In case of javax.servlet.ServletException the 500 error-code handler is not used. I need a <exception-type>javax.servlet.ServletException</exception-type> handler.

       

      With Tomcat 7 no such issues.