13 Replies Latest reply on Mar 15, 2011 8:27 AM by hgk

    NoSuchElementException after upgrading to RichFaces 3.3.3.Final

    hgk

      Hi All,

       

      We recently upgraded our App from RichFaces 3.1.4GA to 3.3.3Final.

       

      Once in a while we see NoSuchElementException in our App after upgrading. This never happened with RichFaces 3.1.4GA.

       

      What has changed in RichFaces 3.3.3 to cause this problem?

       

      I saw the suggested workaround here http://community.jboss.org/message/550934#550934

       

      We have lot of a4j components on our jsp pages. - a4j:poll, a4j:commandLink, a4j:support etc

       

      We have lot of jsp pages in our app. We have to add this suggested popup on every page? Is there any other workaround?

       

      Thanks,

      Bindu

       

      Here is the stacktrace:

       

       

      javax.faces.FacesException: java.util.NoSuchElementException
          at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:166)
          at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:293)
          at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:172)
          at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:293)
          at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:551)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:250)
          at
      org.apache.myfaces.application.jsp.JspViewHandlerImpl.actuallyRenderView(JspViewHandlerImpl.java:427)
          at
      org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:383)
          at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
          at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
          at
      org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
          at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
          at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at com.acopia.common.HomeFilter.doFilter(HomeFilter.java:140)
          at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341)
          at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          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:235)
          at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
          at
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:619)
      Caused by: java.util.NoSuchElementException
          at java.util.AbstractList$Itr.next(AbstractList.java:350)
          at
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:82)
          at
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:157)
          at
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
          at
      org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:157)
          at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:124)
          at org.ajax4jsf.component.UIAjaxRegion.encodeAjax(UIAjaxRegion.java:263)
          at org.ajax4jsf.component.AjaxViewRoot$4.invokeContextCallback(AjaxViewRoot.java:497)
          at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:163)
      
        • 1. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
          nbelaevski

          Hi Hima,

           

          RF 3.1.x is using JSF 1.1 APIs only, while 3.3.x make advantage of available JSF 1.2 API. What is MyFaces version you are using?

          • 2. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
            hgk

            Hi Nick,

             

            We also upgraded myfaces. We are using MyFaces 1.2.8.

             

            Adding "Processing..." popup as suggested in

            http://community.jboss.org/message/550934#550934
            
            on every page could be an overkill. Users will see the popup on every request.

            Is there a better workaround for this NoSuchElementException?

            Thanks,
            Bindu

            • 3. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
              nbelaevski

              Well, this can be a concurrency issue. Have you tried adding a4j:queue/enabling global queue at application level?

              • 4. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                hgk

                I will give that a try. Thanks for your help!

                • 5. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                  scotte

                  I have the same exact problem since upgrading and tried adding the a4j:queue, but still see the problem occasionally.  Is there any solution?

                  • 6. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                    ilya_shaikovsky

                    how you added queue?

                    • 7. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                      scotte

                      Ilya,

                       

                      I think I may have narrowed in on the problem... but I haven't yet come up with a solution.

                       

                      On my page I have a table with 7 columns and it currently has 16 rows.  One of these columnes is a status, which indicates the running progress of the object represented by the row.  From this page the user can launch a wizard and when he has finished with the wizard, the page is updated with a new entry in the table.  At the same time, one or more rows in the table are updating the status column every second to indicate an update to an existing object. Only the status column is being updated... though I've tried updating the whole table and still seen the same issue. I believe that what is happening is that the independent wizard page is requesting a table update at the same time that the table is already queued to have a staus update... I suspect that the conflict is that one request for the table update contains the new row and one does not.  So I need to figure out how to synchronize these activities.  But since the wizard is independent, I don't think the a4j:queue is able to help.

                       

                      But to answer your question, this is what I have for queueing:

                       

                      <f:view>
                      <a4j:queue/>
                      <a4j:queue name="pollQueue" requestDelay="1000"/>
                      <h:form id="ObjectPage">

                      ...

                      code for button to launch the wizard

                      code for the rich:dataTable with a status rich:column

                      ...

                       

                      </h:form>
                       
                      <a4j:region>
                        <h:form>
                          <a4j:poll id="refreshStatus" action="#ObjectPage.updateStatus}" reRender="#{ObjectPage.reRenderIds}"
                                timeout="50000" interval="1000" enabled="#{ObjectPage.refreshEnabled}" eventsQueue="pollQueue"/>
                        </h:form>
                      </a4j:region>

                       

                      (ObjectPage.reRenderIds rerenders either the whole table if the table has changed, or just the column, if only the status has changed)

                       

                      Thanks for any help you can provide!

                      ScottE

                      • 8. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                        scotte

                        Just to clarify, the polling queue is for the status update.  The other queue is for other components on the page (enabling buttons based on the checkboxes on each row)

                        • 9. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                          ilya_shaikovsky

                          leave only on common queue

                          <a4j:queue/>

                           

                          and remove references to all the others.

                          • 10. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                            scotte

                            Thanks Ilya.  That didn't do it either, but we found that we were able to fix the issue by calling an initilization routine by binding to a variable in the bean which got called first via a panelGroup which wrapped the whole page.  Previously we had a jsp:useBean, which wasn't quite working correctly.

                            • 11. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                              hgk

                              We still see NoSuchElementException once in a while.  We use component bindings and the object holding the UIComponent has session scope.

                               

                              Ex:

                              <rich:extendedDataTable binding="{myBean.tableComp}.../>

                              <h:inputText binding="{myBean.myTextField.textComp}

                               

                              myBean has session scope.

                               

                              Are we getting this exception because of the session scope? We always had binding pointing to session object. We started seeing this exception after upgrading from RichFaces 3.1.4GA to 3.3.3Final.

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                               

                              • 12. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                                ilya_shaikovsky
                                We started seeing this exception after upgrading from RichFaces 3.1.4GA to 3.3.3Final.

                                 

                                 

                                And that probably means that you also switched from JSF 1.1 to JSF 1.2 isn't it?

                                 

                                JSF components should not live longer than requests. And if you will search around the web you will find many different problems under different versiosn with that.

                                • 13. Re: NoSuchElementException after upgrading to RichFaces 3.3.3.Final
                                  hgk

                                  Ilya,

                                  Yes we switched from JSF 1.1 to 1.2.  We are using MyFaces implementation.

                                   

                                  JSF 1.1 Spec also says the following:

                                  "It is strongly recommend that application developers place

                                  managed beans that are pointed at by component binding expressions in “request” scope.

                                  This is because placing it in session or application scope would require thread-safety, since

                                  UIComponent instances depends on running inside of a single thread."

                                   

                                  We will change our beans to request scope. Not sure this will solve the problem because we are seeing the Exception only after we moved from RichFaces 3.1.4 to 3.3.3.