javax.faces.FacesException:不能两次添加相同的组件:javax_faces_location_HEAD

时间:2018-12-11 15:44:59

标签: jsf jsf-2.2 tomahawk

我正在尝试将项目从JSF 1.2升级到2.2.18。该应用程序运行良好,可以访问页面,但是主要问题是当我尝试使用按钮玩游戏时,出现以下异常。我已经搜索了这个问题并尝试了一些解决方案,但是除了将javax.faces.PARTIAL_STATE_SAVING设置为false之外,其他解决方案均无效。但是在这种情况下,页面的行为会发生变化,f.i文本框会显示在页面底部。另一方面,我什至不确定该参数是否应该设置为false。一些依赖项是:

<dependency>
    <groupId>com.github.OpenFaces-org</groupId>
    <artifactId>OpenFaces</artifactId>
    <version>v3.0-release</version>
</dependency>
<dependency>
    <groupId>org.apache.myfaces.tomahawk</groupId>
    <artifactId>tomahawk21</artifactId>
    <version>1.1.14</version>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>2.2.18</version>
</dependency>
<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.2.18</version>
</dependency>
<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>6.0</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
</dependency>

我非常担心Tomahawk21会导致此问题,并且不知道如何解决。 <t:saveState value="#{refererBean.referer}"/>使用了这种saveState标记。

Stacktrace:

FINE: No renderer-type for component javax_faces_location_HEAD
Dec 11, 2018 3:19:20 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SEVERE: Error Rendering View[/addRestrictedArticle.xhtml]
javax.faces.FacesException: Cannot add the same component twice: javax_faces_location_HEAD
    at com.sun.faces.context.StateContext$DynamicAddRemoveListener.handleAddRemoveWithAutoPrune(StateContext.java:748)
    at com.sun.faces.context.StateContext$DynamicAddRemoveListener.handleAdd(StateContext.java:664)
    at com.sun.faces.context.StateContext$AddRemoveListener.processEvent(StateContext.java:347)
    at com.sun.faces.context.StateContext$DynamicAddRemoveListener.processEvent(StateContext.java:565)
    at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
    at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
    at com.sun.faces.application.ApplicationImpl.processListenersAccountingForAdds(ApplicationImpl.java:2218)
    at com.sun.faces.application.ApplicationImpl.invokeViewListenersFor(ApplicationImpl.java:2036)
    at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:290)
    at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:245)
    at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:726)
    at org.openfaces.application.OpenFacesApplication.publishEvent(OpenFacesApplication.java:43)
    at javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2254)
    at javax.faces.component.UIComponentBase.doPostAddProcessing(UIComponentBase.java:1935)
    at javax.faces.component.UIComponentBase.setParent(UIComponentBase.java:448)
    at javax.faces.component.UIComponentBase$FacetsMap.put(UIComponentBase.java:3006)
    at javax.faces.component.UIComponentBase$FacetsMap.put(UIComponentBase.java:2966)
    at javax.faces.component.UIViewRoot.getComponentResources(UIViewRoot.java:1818)
    at javax.faces.component.UIViewRoot.addComponentResource(UIViewRoot.java:521)
    at com.sun.faces.application.annotation.ResourceDependencyHandler.pushResourceToRoot(ResourceDependencyHandler.java:126)
    at com.sun.faces.application.annotation.ResourceDependencyHandler.apply(ResourceDependencyHandler.java:107)
    at com.sun.faces.application.annotation.AnnotationManager.applyAnnotations(AnnotationManager.java:377)
    at com.sun.faces.application.annotation.AnnotationManager.applyComponentAnnotations(AnnotationManager.java:279)
    at com.sun.faces.application.ApplicationImpl.applyAnnotations(ApplicationImpl.java:1972)
    at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1922)
    at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:926)
    at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:335)
    at org.openfaces.component.validation.ValidationProcessor.getDefaultPresentationInstance(ValidationProcessor.java:389)
    at org.openfaces.component.validation.ValidationSupportResponseWriter.renderPresentationComponent(ValidationSupportResponseWriter.java:344)
    at org.openfaces.component.validation.ValidationSupportResponseWriter.handleEditableValueHolder(ValidationSupportResponseWriter.java:300)
    at org.openfaces.component.validation.ValidationSupportResponseWriter.processEditableValueHolder(ValidationSupportResponseWriter.java:272)
    at org.openfaces.component.validation.ValidationSupportResponseWriter.startElement(ValidationSupportResponseWriter.java:137)
    at com.sun.faces.renderkit.html_basic.TextareaRenderer.getEndTextToRender(TextareaRenderer.java:91)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:170)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
    at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:169)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
    at com.test.test.web.jsf.view.ExtendedViewHandler.renderView(ExtendedViewHandler.java:56)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)

我希望有人能给我提示。

谢谢。

0 个答案:

没有答案