ICEfaces
  1. ICEfaces
  2. ICE-6269

ClassCastException When Navigating to Page with an ace:fileEntry Component

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0-Beta2
    • Fix Version/s: 2.0.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      All
    • Affects:
      Compatibility/Configuration
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
           <context-param>
              <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
              <param-value>false</param-value>
          </context-param>
      Show
           <context-param>         <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>         <param-value>false</param-value>     </context-param>

      Description

      Class Cast Exception when navigating/displaying a page with the ace:fileEntry component on the page. Exception Stack Trace:

      SEVERE: javax.faces.FacesException: Unexpected error restoring state for component with id javax_faces_location_HEAD. 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:1446)
              at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
              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:430)
              at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
              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:312)
              at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
              at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
              at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
              at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
              at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
              at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
              at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
              at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
              at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
              at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
              at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
              at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
              at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
              at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
              at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.ClassCastException: com.sun.faces.application.view.StateHolderSaver cannot be cast to [Ljava.lang.Object;
              at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1421)
              at com.sun.faces.application.view.StateManagementStrategyImpl$2.visit(StateManagementStrategyImpl.java:231)
              ... 37 more

        Activity

        Hide
        Arran Mccullough added a comment -

        Test case war for Glassfish V3. To reproduce deploy war. Bring up the app and then click the switch button twice.

        Show
        Arran Mccullough added a comment - Test case war for Glassfish V3. To reproduce deploy war. Bring up the app and then click the switch button twice.
        Hide
        Ken Fyten added a comment -

        Arran, can you port the test to tomcat 6 war and attach, pls.

        Show
        Ken Fyten added a comment - Arran, can you port the test to tomcat 6 war and attach, pls.
        Hide
        Arran Mccullough added a comment -

        Test case configured for Tomcat 6
        Note: Had to remove the icefaces.jar, icefaces-compat.jar, and icefaces-ace.jar files to allow it to be attached. Adding the jar files back to the war should allow it to run.

        Show
        Arran Mccullough added a comment - Test case configured for Tomcat 6 Note: Had to remove the icefaces.jar, icefaces-compat.jar, and icefaces-ace.jar files to allow it to be attached. Adding the jar files back to the war should allow it to run.
        Hide
        Ted Goddard added a comment -

        icefaces-compat.jar is not required for this test case. Exception has been reproduced:

        http://localhost:8080/Case9552Example3/welcomeICEfaces.jsf

        javax.faces.FacesException: Unexpected error restoring state for component with id javax_faces_location_HEAD. Cause: java.lang.ClassCastException: com.sun.faces.application.view.StateHolderSaver cannot be cast to [Ljava.lang.Object;.
        at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:250)
        at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:147)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1476)

        Show
        Ted Goddard added a comment - icefaces-compat.jar is not required for this test case. Exception has been reproduced: http://localhost:8080/Case9552Example3/welcomeICEfaces.jsf javax.faces.FacesException: Unexpected error restoring state for component with id javax_faces_location_HEAD. Cause: java.lang.ClassCastException: com.sun.faces.application.view.StateHolderSaver cannot be cast to [Ljava.lang.Object;. at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:250) at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:147) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1476)
        Hide
        Ted Goddard added a comment -

        Same problem reproducible with ace:pushButton.

        Show
        Ted Goddard added a comment - Same problem reproducible with ace:pushButton.
        Hide
        Ted Goddard added a comment -

        Works with:

        <context-param>
        <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
        <param-value>false</param-value>
        </context-param>

        Root cause is the following:

        pushResourceToRoot @javax.faces.application.ResourceDependency(library=org.icefaces.component.fileentry, target=, name=fileEntry.js)

        Shown by logging added to jsf-ri/src/main/java/com/sun/faces/application/annotation/ResourceDependencyHandler.java

        public void apply(FacesContext ctx, Object... params) {

        for (ResourceDependency dep : dependencies) {
        if (!hasBeenProcessed(ctx, dep))

        { pushResourceToRoot(ctx, createComponentResource(ctx, dep)); System.out.println("pushResourceToRoot " + dep); markProcssed(ctx, dep); }

        }

        }

        In order to confirm this outside of ICEfaces, it would be necessary to create a custom component with a ResourceDependency annotation like what triggers the above:

        @ResourceDependency(name="fileEntry.js",library="org.icefaces.component.fileentry",target="")

        Show
        Ted Goddard added a comment - Works with: <context-param> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> <param-value>false</param-value> </context-param> Root cause is the following: pushResourceToRoot @javax.faces.application.ResourceDependency(library=org.icefaces.component.fileentry, target=, name=fileEntry.js) Shown by logging added to jsf-ri/src/main/java/com/sun/faces/application/annotation/ResourceDependencyHandler.java public void apply(FacesContext ctx, Object... params) { for (ResourceDependency dep : dependencies) { if (!hasBeenProcessed(ctx, dep)) { pushResourceToRoot(ctx, createComponentResource(ctx, dep)); System.out.println("pushResourceToRoot " + dep); markProcssed(ctx, dep); } } } In order to confirm this outside of ICEfaces, it would be necessary to create a custom component with a ResourceDependency annotation like what triggers the above: @ResourceDependency(name="fileEntry.js",library="org.icefaces.component.fileentry",target="")
        Hide
        Ted Goddard added a comment -

        Test with JSF 2.1 before closing.

        Show
        Ted Goddard added a comment - Test with JSF 2.1 before closing.
        Hide
        Ted Goddard added a comment -

        Tested with Mojarra 2.1.0 (SNAPSHOT 20100903) and issue is still present. This may be fixed in a more recent version of JSF 2.1, but javaserverfaces.dev.java.net is still offline.

        If an application is using ACE and components are dynamically added or removed from the page due to Facelet processing, Partial State Saving must be disabled:

        <context-param>
        <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
        <param-value>false</param-value>
        </context-param>

        Show
        Ted Goddard added a comment - Tested with Mojarra 2.1.0 (SNAPSHOT 20100903) and issue is still present. This may be fixed in a more recent version of JSF 2.1, but javaserverfaces.dev.java.net is still offline. If an application is using ACE and components are dynamically added or removed from the page due to Facelet processing, Partial State Saving must be disabled: <context-param> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> <param-value>false</param-value> </context-param>
        Hide
        Ted Goddard added a comment -

        Need to test with Dec 10 JSF 2.1.

        Show
        Ted Goddard added a comment - Need to test with Dec 10 JSF 2.1.
        Hide
        Ted Goddard added a comment -

        INFO: Initializing Mojarra 2.1.0 (SNAPSHOT b09) for context '/Case9552Example3'

        Able to switch between the dynamic include with no ClassCastException.

        Show
        Ted Goddard added a comment - INFO: Initializing Mojarra 2.1.0 (SNAPSHOT b09) for context '/Case9552Example3' Able to switch between the dynamic include with no ClassCastException.
        Hide
        Ted Goddard added a comment -

        This is fixed in an upcoming version of JSF 2.1.

        Show
        Ted Goddard added a comment - This is fixed in an upcoming version of JSF 2.1.

          People

          • Assignee:
            Ted Goddard
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: