Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf java.lang.ClassCastException:javax.faces.component.StateHolderSaver不能强制转换为[Ljava.lang.Object;_Jsf_Jsf 2_Liferay_Liferay 6 - Fatal编程技术网

Jsf java.lang.ClassCastException:javax.faces.component.StateHolderSaver不能强制转换为[Ljava.lang.Object;

Jsf java.lang.ClassCastException:javax.faces.component.StateHolderSaver不能强制转换为[Ljava.lang.Object;,jsf,jsf-2,liferay,liferay-6,Jsf,Jsf 2,Liferay,Liferay 6,我在我的xhtml页面中显示带有链接的项目列表。当我从该链接中单击“返回上一页”按钮时,我基本上重置了bean中的标志,以指示xhtml显示哪个页面,并从数据库中重新加载链接列表 当我单击此新页面中的同一链接(或任何其他相关链接)时,会出现以下错误: javax.portlet.faces.BridgeException: javax.portlet.faces.BridgeException: javax.faces.FacesException: Unexpected error r

我在我的xhtml页面中显示带有链接的项目列表。当我从该链接中单击“返回上一页”按钮时,我基本上重置了bean中的标志,以指示xhtml显示哪个页面,并从数据库中重新加载链接列表

当我单击此新页面中的同一链接(或任何其他相关链接)时,会出现以下错误:

javax.portlet.faces.BridgeException: javax.portlet.faces.BridgeException: javax.faces.FacesException: 
   Unexpected error restoring state for component with id A8351:j_idt7:j_idt10:j_idt59.  
   Cause: java.lang.ClassCastException: javax.faces.component.StateHolderSaver cannot be cast to [Ljava.lang.Object;.
    at com.liferay.faces.bridge.BridgePhaseActionImpl.execute(BridgePhaseActionImpl.java:105)
    at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:81)
        at javax.portlet.faces.GenericFacesPortlet.processAction(GenericFacesPortlet.java:152)
    at com.ncs.portalcity.lfe.faces.bridge.FacesPortlet.processAction(FacesPortlet.java:47)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    ...
    ...
Caused by: javax.faces.FacesException: Unexpected error restoring state for component
with id A8351:j_idt7:j_idt10:j_idt59.  Cause: java.lang.ClassCastException: javax.faces.component.StateHolderSaver cannot be cast to [Ljava.lang.Object;.
    at com.sun.faces.application.view.StateManagementStrategyImpl$2.visit(StateManagementStrategyImpl.java:284)
    at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1589)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIForm.visitTree(UIForm.java:344)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:263)
    at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:188)
    at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:452)
    at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:148)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
    at com.liferay.faces.bridge.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:88)
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at com.liferay.faces.bridge.lifecycle.LifecycleWrapper.execute(LifecycleWrapper.java:35)
    at com.liferay.faces.bridge.BridgePhaseActionImpl.execute(BridgePhaseActionImpl.java:77)
    ... 142 more
Caused by: java.lang.ClassCastException: javax.faces.component.StateHolderSaver cannot be cast to [Ljava.lang.Object;
    at javax.faces.component.behavior.AjaxBehavior.restoreState(AjaxBehavior.java:459)
    at javax.faces.component.UIComponentBase.restoreBehaviors(UIComponentBase.java:2184)
    at javax.faces.component.UIComponentBase.restoreBehaviorsState(UIComponentBase.java:2151)
    at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1571)
    at com.sun.faces.application.view.StateManagementStrategyImpl$2.visit(StateManagementStrategyImpl.java:276)
    ... 162 more
如果我刷新页面并重试,则不会出现问题。有人知道我做错了什么吗

----编辑----

为了防止其他使用liferay的人遇到这个问题,我刚刚在pom.xml中添加了这些行,现在一切正常:)非常感谢BaluC

<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.1.21</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.1.21</version>
    <scope>compile</scope>
</dependency>

com.sun.faces
JSFAPI
2.1.21
编译
com.sun.faces
jsf impl
2.1.21
编译

这是一个已知的Mojarra问题,已在Mojarra 2.1.12中修复

因此,只需将JSF库升级到至少Mojarra 2.1.12就可以了。它目前已经达到2.1.26,与2.1.12相比,有更多与状态管理相关的修复程序