Richfaces和Primefaces是否相互兼容?

时间:2010-09-22 17:29:06

标签: jsf richfaces primefaces

我现在正在使用Primefaces-2.1,我尝试在我的应用程序中集成Richfaces-3.3.3以便使用<rich:jQuery>。我的<p:commandButton><p:commandLink>在我整合Richfaces后立即停止工作,我给了我这个例外:任何想法为什么?

Exception in the filter chain
javax.servlet.ServletException: Index: 0, Size: 0
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at com.scholar.filter.MyFilter.doFilter(MyFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
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:637)

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:161)
at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1427)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1202)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
at javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:865)
at org.ajax4jsf.component.AjaxViewRoot.processRestoreState(AjaxViewRoot.java:761)
at org.ajax4jsf.application.AjaxStateManager.restoreView(AjaxStateManager.java:456)
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 javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
at org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:107)
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)

这是我的web.xml

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
    <display-name>RichFaces Filter</display-name>
    <filter-name>richfaces</filter-name>
    <filter-class>org.ajax4jsf.Filter</filter-class>
</filter>

<filter-mapping>
    <filter-name>richfaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>

以下是我所包含的所有图书馆:
Primefaces-2.1
RichFaces的-3.3.3
共享记录-1.1.1
共享消化器-2.0
下议院-BeanUtils的-1.8.3
JHighlight-1.0

1 个答案:

答案 0 :(得分:4)

虽然没有正式记录(据我所知),一般(和逻辑)的共识是你经常不能混合基于JSF 1.x的Ajax和CSS / JS这样的库,因为它们可能有不同的(因此,冲突的)视图状态和资源处理方式。 JSF 2.x应该带来变化,因为它标准化部分(Ajaxical)视图状态处理以及新API中的资源(CSS / JS)处理。 RichFaces 3.x并不完全兼容JSF 2.0,而PrimeFaces 2.x则是这种冲突。

RichFaces 4.x应该完全兼容JSF 2.0。但即便如此,在混合使用“重量级”的Ajax / CSS / JS库时,我也没有强烈的成功感。 “原始”CSS和JS领域的冲突仍然存在风险,因为JSF规范没有对其进行标准化。