2012-08-24 56 views
1

對於我得到以下錯誤一個簡單的JSF 2.0和Tomcat 7應用:ClassCastException異常:UIViewRoot不能轉換到org.portletfaces.bridge.component.PortletNamingContainerUIViewRoot

Casting Error java.lang.ClassCastException: javax.faces.component.UIViewRoot cannot be cast to org.portletfaces.bridge.component.PortletNamingContainerUIViewRoot

Aug 24, 2012 11:55:40 AM com.sun.faces.application.view.FaceletViewHandlingStrategy  handleRenderException 
SEVERE: Error Rendering View[/hello.xhtml] 
java.lang.ClassCastException: javax.faces.component.UIViewRoot cannot be cast to org.portletfaces.bridge.component.PortletNamingContainerUIViewRoot 
at org.portletfaces.bridge.renderkit.html_basic.HeadRenderer.encodeBegin(HeadRenderer.java:62) 
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:823) 
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1611) 
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616) 
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrateg  y.java:380) 

hello.xhtml如下:

 <?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:f="http://java.sun.com/jsf/core"  
    xmlns:h="http://java.sun.com/jsf/html"> 

<h:body> 

    <h:form> 
     <h:commandButton value="Welcome Me" action="welcome"></h:commandButton> 
    </h:form> 
</h:body> 
    </html> 

回答

0

我也有同樣的問題。但是,一旦h:head或h:body被刪除,頁面加載好,除了javascript和css,需要h:head。這些將不會被加載。

相關問題