ICEfaces-EE
  1. ICEfaces-EE
  2. IPCK-418

ClassCastException thrown when including the icefaces-ee-accessible.jar file on the classpath

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.0.0.GA_P01
    • Fix Version/s: EE-3.2.0.GA
    • Component/s: Accessible Components
    • Labels:
      None
    • Environment:
      All
    • Assignee Priority:
      P1
    • Salesforce Case Reference:

      Description

      A ClassCastException is thrown when a partial submit is fired on and ice:inputText component. The inputText component uses and el expresion for the required attribute. Sample code:

              <c:set var="required" value="true" />
              <ice:form id="form">
                  <ice:inputText id="testIceVar" value="somevalue" required="#{required}" partialSubmit="true" />
              </ice:form>

      On the surface, it looks like we might have some package+classname duplication between the icefaces-ee-compat.jar and the icefaces-ee-accessible.jar.

        Activity

        Migration created issue -
        Hide
        Arran Mccullough added a comment - - edited

        Error Stacktrace:
        java.lang.ClassCastException: com.icesoft.faces.el.PartialSubmitValueBinding cannot be cast to java.io.Serializable
        at javax.faces.component.StateHolderSaver.<init>(StateHolderSaver.java:103)
        at javax.faces.component.UIComponentBase.saveAttachedState(UIComponentBase.java:1695)
        at javax.faces.component.ComponentStateHelper.saveMap(ComponentStateHelper.java:378)
        at javax.faces.component.ComponentStateHelper.saveState(ComponentStateHelper.java:256)
        at javax.faces.component.UIComponentBase.saveState(UIComponentBase.java:1501)
        at javax.faces.component.UIOutput.saveState(UIOutput.java:222)
        at javax.faces.component.UIInput.saveState(UIInput.java:1385)
        at com.icesoft.faces.component.ext.HtmlInputText.saveState(HtmlInputText.java:579)
        at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:168)
        at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1590)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601)
        at javax.faces.component.UIForm.visitTree(UIForm.java:344)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601)
        at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:160)
        at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133)
        at javax.faces.application.StateManager.getViewState(StateManager.java:553)
        at org.icefaces.impl.event.FixViewState$ScriptWriter.encode(FixViewState.java:64)
        at org.icefaces.impl.event.UIOutputWriter.encodeBegin(UIOutputWriter.java:27)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1755)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
        at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:153)
        at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391)
        at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

        Show
        Arran Mccullough added a comment - - edited Error Stacktrace: java.lang.ClassCastException: com.icesoft.faces.el.PartialSubmitValueBinding cannot be cast to java.io.Serializable at javax.faces.component.StateHolderSaver.<init>(StateHolderSaver.java:103) at javax.faces.component.UIComponentBase.saveAttachedState(UIComponentBase.java:1695) at javax.faces.component.ComponentStateHelper.saveMap(ComponentStateHelper.java:378) at javax.faces.component.ComponentStateHelper.saveState(ComponentStateHelper.java:256) at javax.faces.component.UIComponentBase.saveState(UIComponentBase.java:1501) at javax.faces.component.UIOutput.saveState(UIOutput.java:222) at javax.faces.component.UIInput.saveState(UIInput.java:1385) at com.icesoft.faces.component.ext.HtmlInputText.saveState(HtmlInputText.java:579) at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:168) at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1590) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) at javax.faces.component.UIForm.visitTree(UIForm.java:344) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) at javax.faces.component.UIComponent.visitTree(UIComponent.java:1601) at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:160) at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133) at javax.faces.application.StateManager.getViewState(StateManager.java:553) at org.icefaces.impl.event.FixViewState$ScriptWriter.encode(FixViewState.java:64) at org.icefaces.impl.event.UIOutputWriter.encodeBegin(UIOutputWriter.java:27) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1755) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760) at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:153) at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
        Hide
        Arran Mccullough added a comment - - edited

        Attached test case that shows issue.

        Steps:

        • Load welcomeICEfaces.jsf
        • Enter in some text to the input field.
        • Tab out, exception is thrown
        Show
        Arran Mccullough added a comment - - edited Attached test case that shows issue. Steps: Load welcomeICEfaces.jsf Enter in some text to the input field. Tab out, exception is thrown
        Hide
        yip.ng added a comment - - edited

        PartialSubmitValueBinding present only in icefaces-ee-compat.jar, so no question of "package+classname duplication."
        Problem is caused by the use of <c:set>, not partial submit:
        <c:set var="required" value="true" />
        ......
        <ice:inputText ... required="#

        {required}

        " ... />
        If we just use required="true", then everything works fine.
        What exactly does <c:set> do behind the scenes?

        Show
        yip.ng added a comment - - edited PartialSubmitValueBinding present only in icefaces-ee-compat.jar, so no question of "package+classname duplication." Problem is caused by the use of <c:set>, not partial submit: <c:set var="required" value="true" /> ...... <ice:inputText ... required="# {required} " ... /> If we just use required="true", then everything works fine. What exactly does <c:set> do behind the scenes?
        Hide
        Ted Goddard added a comment - - edited

        Which version of mojarra is used for this test? There are various state saving problems prior to mojarra 2.1.8 that could lead to the Exception.

        Show
        Ted Goddard added a comment - - edited Which version of mojarra is used for this test? There are various state saving problems prior to mojarra 2.1.8 that could lead to the Exception.
        Migration made changes -
        Field Original Value New Value
        Reporter Migration [ remote ] Arran Mccullough [ arran.mccullough ]
        Migration made changes -
        Assignee Ken Fyten [ ken.fyten ] yip.ng [ yip.ng ]
        Fix Version/s EE-3.2.0.GA [ 10326 ]
        Assignee Priority P3 [ 10012 ]
        Migration made changes -
        Attachment Case11618Example.war [ 14951 ]
        Ken Fyten made changes -
        Comment [ On the surface, it looks like we might have some package+classname duplication between the icefaces-ee-compat.jar and the icefaces-ee-accessible.jar.

        (Restricted to icesoft-internal-developers group)
        ]
        Ken Fyten made changes -
        Description
        A ClassCastException is thrown when a partial submit is fired on and ice:inputText component. The inputText component uses and el expresion for the required attribute. Sample code:

                <c:set var="required" value="true" />
                <ice:form id="form">
                    <ice:inputText id="testIceVar" value="somevalue" required="#{required}" partialSubmit="true" />
                </ice:form>
        A ClassCastException is thrown when a partial submit is fired on and ice:inputText component. The inputText component uses and el expresion for the required attribute. Sample code:

                <c:set var="required" value="true" />
                <ice:form id="form">
                    <ice:inputText id="testIceVar" value="somevalue" required="#{required}" partialSubmit="true" />
                </ice:form>

        On the surface, it looks like we might have some package+classname duplication between the icefaces-ee-compat.jar and the icefaces-ee-accessible.jar.
        Ken Fyten made changes -
        Comment [ On the surface, it looks like we might have some package+classname duplication between the icefaces-ee-compat.jar and the icefaces-ee-accessible.jar.

        (Restricted to icesoft-internal-developers group)
        ]
        Hide
        Mark Collette added a comment -

        If you guys look at my jira I recently created:
        ICE-8747 : FixViewState use of StateManager.getViewState(FC) disrupts state saving under MyFaces

        You see that with MyFaces, FixViewState causes state saving to happen too early, in the middle of rendering. Presumably we temporarily put the PartialSubmitValueBinding objects in place, and intend to remove them before state saving occurs, but FixViewState messes that up.

        Show
        Mark Collette added a comment - If you guys look at my jira I recently created: ICE-8747 : FixViewState use of StateManager.getViewState(FC) disrupts state saving under MyFaces You see that with MyFaces, FixViewState causes state saving to happen too early, in the middle of rendering. Presumably we temporarily put the PartialSubmitValueBinding objects in place, and intend to remove them before state saving occurs, but FixViewState messes that up.
        Mark Collette made changes -
        Link This issue depends on ICE-8747 [ ICE-8747 ]
        Arran Mccullough made changes -
        Salesforce Case Reference 5007000000O9qrZAAR
        Hide
        Deryk Sinotte added a comment -

        I wasn't able to reproduce the issue cited with the test case. Can someone confirm that the behaviour is still a problem?

        Show
        Deryk Sinotte added a comment - I wasn't able to reproduce the issue cited with the test case. Can someone confirm that the behaviour is still a problem?
        Hide
        Deryk Sinotte added a comment -

        So, now that I add the accessible component library is in there, I do see the exception. However, I'm wondering how valid the page markup is:

        <c:set var="required" value="true" />
        <ice:form id="form">
        <ice:inputText id="testIceVar" value="somevalue" required="#

        {required}" partialSubmit="true" />
        </ice:form>

        * I removed the c:set and that didn't have any effect.
        * I removed the partialSubmit and that helped but only because nothing gets submitted.
        * I then removed the required and put back the partialSubmit and that worked.
        * I then added back the required and set it to required="true" and that worked fine as well.

        The test case didn't actually come with any backing beans or anything. I think it might just be complaining that it can't resolve #{required}

        to anything useful but I'm not sure why it only complains when the accessible library is present.

        Show
        Deryk Sinotte added a comment - So, now that I add the accessible component library is in there, I do see the exception. However, I'm wondering how valid the page markup is: <c:set var="required" value="true" /> <ice:form id="form"> <ice:inputText id="testIceVar" value="somevalue" required="# {required}" partialSubmit="true" /> </ice:form> * I removed the c:set and that didn't have any effect. * I removed the partialSubmit and that helped but only because nothing gets submitted. * I then removed the required and put back the partialSubmit and that worked. * I then added back the required and set it to required="true" and that worked fine as well. The test case didn't actually come with any backing beans or anything. I think it might just be complaining that it can't resolve #{required} to anything useful but I'm not sure why it only complains when the accessible library is present.
        Hide
        Deryk Sinotte added a comment -

        In the icefaces-ee-accessible.jar, at the bottom of the META-INF/faces-config.xml file there is the following:

            <!-- configuration taken from compat/components -->
            <ordering>
                <after>
                    <name>ICEfacesCore</name>
                </after>
            </ordering>
            <lifecycle>
                <phase-listener>com.icesoft.faces.application.PartialSubmitPhaseListener</phase-listener>
            </lifecycle>
            <factory>
                <partial-view-context-factory>com.icesoft.faces.context.CompatDOMPartialViewContextFactory
                </partial-view-context-factory>
            </factory>
        

        This duplicates what is already in icefaces-compat.jar. Not sure if the accessible library can work without the compat components or not but the double registration of the com.icesoft.faces.application.PartialSubmitPhaseListener seems to be the problem. If I remove that from the faces-config file, the problem goes away.

        Show
        Deryk Sinotte added a comment - In the icefaces-ee-accessible.jar, at the bottom of the META-INF/faces-config.xml file there is the following: <!-- configuration taken from compat/components --> <ordering> <after> <name>ICEfacesCore</name> </after> </ordering> <lifecycle> <phase-listener>com.icesoft.faces.application.PartialSubmitPhaseListener</phase-listener> </lifecycle> <factory> <partial-view-context-factory>com.icesoft.faces.context.CompatDOMPartialViewContextFactory </partial-view-context-factory> </factory> This duplicates what is already in icefaces-compat.jar. Not sure if the accessible library can work without the compat components or not but the double registration of the com.icesoft.faces.application.PartialSubmitPhaseListener seems to be the problem. If I remove that from the faces-config file, the problem goes away.
        Ken Fyten made changes -
        Assignee Priority P3 [ 10012 ] P1 [ 10010 ]
        Hide
        Ken Fyten added a comment -

        Yip, please go ahead and remove the PartialSubmitPhaseListener from the Accessible Comps lib. This is not required by accessible and would already be setup by Compat, which Accessible requires anyway.

        Show
        Ken Fyten added a comment - Yip, please go ahead and remove the PartialSubmitPhaseListener from the Accessible Comps lib. This is not required by accessible and would already be setup by Compat, which Accessible requires anyway.
        Ken Fyten made changes -
        Salesforce Case Reference 5007000000O9qrZAAR
        Ken Fyten made changes -
        Link This issue depends on ICE-8747 [ ICE-8747 ]
        Hide
        Mark Collette added a comment -

        I believe that this:
        <c:set var="required" value="true" />
        <ice:inputText required="#

        {required}

        " partialSubmit="true" />

        Is just another way of doing this:
        <ice:inputText value="required="#

        {true}

        " partialSubmit="true" />

        Which is to test the case where the required property has a ValueExpression, and not just a simple Boolean value. This is because the bug is with the replacement faked ValueExpression not being Serializable, and not yet having been swapped with the real one when our code prematurely triggers state saving.

        Show
        Mark Collette added a comment - I believe that this: <c:set var="required" value="true" /> <ice:inputText required="# {required} " partialSubmit="true" /> Is just another way of doing this: <ice:inputText value="required="# {true} " partialSubmit="true" /> Which is to test the case where the required property has a ValueExpression, and not just a simple Boolean value. This is because the bug is with the replacement faked ValueExpression not being Serializable, and not yet having been swapped with the real one when our code prematurely triggers state saving.
        Hide
        Deryk Sinotte added a comment -

        That makes sense. I retested putting everything back the way it was. Removing the duplicate PhaseListener "fixes" this particular problem.

        Show
        Deryk Sinotte added a comment - That makes sense. I retested putting everything back the way it was. Removing the duplicate PhaseListener "fixes" this particular problem.
        Arran Mccullough made changes -
        Salesforce Case Reference 5007000000O9qrZAAR
        Hide
        yip.ng added a comment -

        Done. Error gone.

        Subversion: Committed revision 33300.

        M: C:\svn\repo\icefaces-ee3\trunk\icefaces-ee\ee-comps\ee-accessible\component-metadata\src\main\resources\com\icesoft\jsfmeta\templates\jsf11\resources\faces-config-rt.ftl#33300

        Show
        yip.ng added a comment - Done. Error gone. Subversion: Committed revision 33300. M: C:\svn\repo\icefaces-ee3\trunk\icefaces-ee\ee-comps\ee-accessible\component-metadata\src\main\resources\com\icesoft\jsfmeta\templates\jsf11\resources\faces-config-rt.ftl#33300
        yip.ng made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            yip.ng
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: