5 Replies Latest reply on Aug 11, 2007 10:54 AM by Bruno Arruda

    Error handling A4J class cast exception

    Bruno Arruda Newbie

      Hi, Im trying to setup error page handling on web.xml, but I´m getting a A4J cast exception, can anyone give a light on that plz?Thanks in advance.

      My web.xml declaration:

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



      SEVERE: Exception Processing ErrorPage[exceptionType=javax.servlet.ServletException, location=/error.jsf]
      javax.servlet.ServletException: org.ajax4jsf.framework.ajax.AjaxViewRoot cannot be cast to com.sun.faces.application.StateManagerImpl$TreeNode
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
       at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
       at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.ClassCastException: org.ajax4jsf.framework.ajax.AjaxViewRoot cannot be cast to com.sun.faces.application.StateManagerImpl$TreeNode
       at com.sun.faces.application.StateManagerImpl.restoreTree(StateManagerImpl.java:602)
       at com.sun.faces.application.StateManagerImpl.restoreTree(StateManagerImpl.java:551)
       at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:87)
       at org.ajax4jsf.framework.ajax.AjaxStateManager.restoreView(AjaxStateManager.java:83)
       at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:287)
       at org.ajax4jsf.framework.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:116)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.restoreView(AjaxViewHandler.java:152)
       at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:137)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       ... 16 more
      


        • 1. Re: Error handling A4J class cast exception
          Alexander Smirnov Master

          What version of the JSF libraries ?
          At least, jsf error page work fine with a SUN RI 1.2_04

          • 2. Re: Error handling A4J class cast exception
            Bruno Arruda Newbie

            I´m using SUN RI 1.2_04 too. Any ideas?

            • 3. Re: Error handling A4J class cast exception
              Alexander Smirnov Master

              I'm check JSF RI 1.2_04 source code. In case of the client-side state Saving, JSF keep restored tree structure in the request-scope attribute. Redirect to a error page don't clear such attributes.
              Can you try to set server-side state saving ?

              • 4. Re: Error handling A4J class cast exception
                Bruno Arruda Newbie

                Thanks for the help, i did what you asked , now I´m receiving the following error, but I´m wondering, no one ever tried to use the combination a4j + jsf 1.2 + error-page before ? strange... Thanks again


                WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@94b318) threw exception
                java.lang.IllegalStateException: Cannot forward after response has been committed
                 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
                 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
                 at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:428)
                 at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:444)
                 at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:116)
                 at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:235)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
                 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
                 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
                 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
                 at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
                 at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
                08/08/2007 21:29:51 org.apache.catalina.core.ApplicationDispatcher invoke
                SEVERE: Servlet.service() for servlet Faces Servlet threw exception
                java.lang.IllegalStateException: Cannot forward after response has been committed
                 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
                 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
                 at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:428)
                 at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:444)
                 at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:116)
                 at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:235)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
                 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
                 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
                 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
                 at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
                 at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
                08/08/2007 21:29:51 org.apache.catalina.core.StandardHostValve custom
                SEVERE: Exception Processing ErrorPage[exceptionType=javax.servlet.ServletException, location=/error.jsf]
                javax.servlet.ServletException: Cannot forward after response has been committed
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
                 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
                 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
                 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
                 at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
                 at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
                Caused by: java.lang.IllegalStateException: Cannot forward after response has been committed
                 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
                 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
                 at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:428)
                 at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:444)
                 at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:116)
                 at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                 at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:235)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                
                


                • 5. Re: Error handling A4J class cast exception
                  Bruno Arruda Newbie

                  any ideas? this is really important to me ...
                  thx again