ICEfaces
  1. ICEfaces
  2. ICE-5157

ICEfaces 2.0: ClassCastException during navigation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha1
    • Fix Version/s: 2.0-Alpha3, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces 2.0

      Description

      javax.faces.FacesException: Unexpected error restoring state for component with id javax_faces_location_BODY. Cause: java.lang.ClassCastException: com.sun.faces.application.view.StateHolderSaver cannot be cast to [Ljava.lang.Object;.
      at com.sun.faces.application.view.StateManagementStrategyImpl$2.visit(StateManagementStrategyImpl.java:239)
      at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:147)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1443)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1454)
      at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:223)
      at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
      at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:429)
      at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
      at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
      at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
      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.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:637)

        Issue Links

          Activity

          Hide
          Ted Goddard added a comment -

          https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1427

          User edburns changed the following:

          What |Old value |New value
          ================================================================================
          Status|NEW |STARTED
          --------------------------------------------------------------------------------
          Priority|P3 |P2
          --------------------------------------------------------------------------------
          Target milestone|2.0.next |2.0.3
          --------------------------------------------------------------------------------

          Show
          Ted Goddard added a comment - https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1427 User edburns changed the following: What |Old value |New value ================================================================================ Status|NEW |STARTED -------------------------------------------------------------------------------- Priority|P3 |P2 -------------------------------------------------------------------------------- Target milestone|2.0.next |2.0.3 --------------------------------------------------------------------------------
          Hide
          Ted Goddard added a comment -

          Update from Roger:

          We have a slightly alternative solution for this fix as making the component transient works fine
          in certain (but not all) situations. I'm working on that and will test it and keep you posted.

          Show
          Ted Goddard added a comment - Update from Roger: We have a slightly alternative solution for this fix as making the component transient works fine in certain (but not all) situations. I'm working on that and will test it and keep you posted.
          Hide
          Ted Goddard added a comment -

          The following hack in

          core/src/main/java/org/icefaces/facelets/tag/icefaces/core/ConfigHandler.java

          attributes.put( EnvUtils.ARIA_ENABLED,
          new Boolean(ariaEnabled.getValue()) );
          }
          + //TODO: remove when JSF 2.0 Partial State Saving fixed
          + //touched in the head
          + facesContext.getViewRoot().addComponentResource( facesContext,
          + new UIOutput(), "head" );
          }
          }

          has been added. This "works" because it causes the HEAD resource component to use the same state-saving strategy on the ICEfaces page as on the non-ICEfaces page with an f:ajax component. Without this, ICEfaces will attempt to dynamically add resources to the HEAD just prior to render (well after Facelet page assembly), causing the HEAD resource component to use a DYNAMIC_COMPONENT strategy in com/sun/faces/application/view/StateManagementStrategyImpl.java. This is incompatible with the component with the same ID used by the navigated-to page since the f:ajax tag forces the non-dynamic strategy.

          Show
          Ted Goddard added a comment - The following hack in core/src/main/java/org/icefaces/facelets/tag/icefaces/core/ConfigHandler.java attributes.put( EnvUtils.ARIA_ENABLED, new Boolean(ariaEnabled.getValue()) ); } + //TODO: remove when JSF 2.0 Partial State Saving fixed + //touched in the head + facesContext.getViewRoot().addComponentResource( facesContext, + new UIOutput(), "head" ); } } has been added. This "works" because it causes the HEAD resource component to use the same state-saving strategy on the ICEfaces page as on the non-ICEfaces page with an f:ajax component. Without this, ICEfaces will attempt to dynamically add resources to the HEAD just prior to render (well after Facelet page assembly), causing the HEAD resource component to use a DYNAMIC_COMPONENT strategy in com/sun/faces/application/view/StateManagementStrategyImpl.java. This is incompatible with the component with the same ID used by the navigated-to page since the f:ajax tag forces the non-dynamic strategy.
          Hide
          Deryk Sinotte added a comment -

          I've added an additional line of code to touch the body as well:

          facesContext.getViewRoot().addComponentResource( facesContext, new UIOutput(), "head" );

          This seems to ensure that the same state-saving strategy is employed and I now no longer see any of the noted exceptions. Resolving as fixed.

          Show
          Deryk Sinotte added a comment - I've added an additional line of code to touch the body as well: facesContext.getViewRoot().addComponentResource( facesContext, new UIOutput(), "head" ); This seems to ensure that the same state-saving strategy is employed and I now no longer see any of the noted exceptions. Resolving as fixed.
          Hide
          Deryk Sinotte added a comment -

          Noting that this fix is currently dependent on 2.0.2 and should be re-examined when Mojarra 2.0.3 is officially available.

          Show
          Deryk Sinotte added a comment - Noting that this fix is currently dependent on 2.0.2 and should be re-examined when Mojarra 2.0.3 is officially available.

            People

            • Assignee:
              Deryk Sinotte
              Reporter:
              Ted Goddard
            • Votes:
              3 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: