views:

183

answers:

1

I am using Primefaces-2.1 now, I try to integrate Richfaces-3.3.3 in my application in order to use <rich:jQuery>. My <p:commandButton>, <p:commandLink> stop working as soon as I integrate the Richfaces, I give me this exception: Any idea why?

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)

Here is my 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>

And here is all the library I include:
Primefaces-2.1
Richfaces-3.3.3
Commons-Logging-1.1.1
Commons-Digester-2.0
Commons-Beanutils-1.8.3
JHighlight-1.0

+3  A: 

Although not officially documented (as far as I see), the general (and logical) consensus is that you often cannot mix JSF 1.x based Ajax and CSS/JS sugared libraries like that, because they might have a different (thus, conflicting) way of view state and resource handling. JSF 2.x should bring change, because it standardizes partial (Ajaxical) view state handling as well as resource (CSS/JS) handling in the new API's. RichFaces 3.x isn't fully JSF 2.0 compatible, while PrimeFaces 2.x is, hence this conflict.

RichFaces 4.x should be fully JSF 2.0 compatible. But even then, I don't have a strong feeling of success when it comes to mixing "heavy-weight" Ajax/CSS/JS libraries like that. There are still risks in conflicts in "raw" CSS and JS areas since that's not standardized by JSF spec.

BalusC
So I guess what you really say is that for now, they are not compatible. Ahh that just sad.One question for you though: when u said `you often cannot mix JSF 1.x based Ajax and CSS sugared libraries like that,`, do you talk in general or you specifically refer about me :D . I always thought that I've been using JSF 2, since it come by default with JEE6.
Harry Pham
No, I didn't mean it personally with "you". Just "anybody" in general. RichFaces 3.x is built on top of JSF 1.2, not 2.0, so it doesn't make use of JSF 2.0 API provided partial state management and resource handling.
BalusC
nahh, I did not take it personally at all. I am learning, so I value everything you said, I just want to make sure, I have not mistakenly been using JSF 1.2 all along. :D Ohhh Richfaces-4.x is getting close to its final release, so I guess JSF2.0 will be supported by then. From what your comment on the other topics,`PrimeFaces by the way wraps all this particular jQuery verbosity in a p:effect component, among others.` It a bit let down from Primefaces. However, definitely take your opinion about heavy-weight ajax framework into consideration
Harry Pham
RichFaces (like PrimeFaces and others) is a JSF component library, not a JSF implementation. Mojarra is a JSF implementation. The JSF version which you would be using concerns the one of the implementation used. RichFaces 3.x is created on top of JSF 1.2. By the way, I already noticed your other question -an interesting one btw- and played somewhat around it, but couldn't seem to find a nice way. Maybe later if I have more playtime. It's a challenge :)
BalusC
I am glad to hear that you take an interest in my other question. If you ever come to nice solution, I hope you can share it :D Thank you, BalusC
Harry Pham
Hi BalusC!!! was you able to figure the solution to my question about creating effect when insert new row into dataTable? Thank you and have a wonderful day.
Harry Pham