1 2 Previous Next 17 Replies Latest reply on Jun 4, 2009 9:47 AM by nbelaevski

    java.util.NoSuchElementException

      Hi - I occasionally get the following error after making a menu selection:

      02-Jun-2009 11:42:15 com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/pages/pageHome.jspx]
      java.util.NoSuchElementException
       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:844)
       at java.util.HashMap$KeyIterator.next(HashMap.java:877)
       at java.util.AbstractCollection.toArray(AbstractCollection.java:176)
       at javax.faces.component.UIComponentBase.saveBindingsState(UIComponentBase.java:1473)
       at javax.faces.component.UIComponentBase.saveState(UIComponentBase.java:1266)
       at javax.faces.component.UICommand.saveState(UICommand.java:324)
       at org.ajax4jsf.component.html.HtmlAjaxCommandButton.saveState(HtmlAjaxCommandButton.java:1323)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1103)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1119)
       at org.ajax4jsf.application.AjaxStateManager.getComponentStateToSave(AjaxStateManager.java:175)
       at org.ajax4jsf.application.AjaxStateManager.buildViewState(AjaxStateManager.java:474)
       at org.ajax4jsf.application.AjaxStateManager.saveSerializedView(AjaxStateManager.java:426)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:615)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
       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.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:595)
      


      Any ideas?

      Regards,

      Michael

        • 1. Re: java.util.NoSuchElementException
          ilya_shaikovsky

          show please at least the page where it occurs.

          • 2. Re: java.util.NoSuchElementException

            Sure, here it is:

            <?xml version="1.0" encoding="UTF-8" ?>
            <html xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:c="http://java.sun.com/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions"
             xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
            
            <body>
             <ui:composition>
             <h:form id="liquidityTableForm">
             <h:panelGrid id="liquidityPanelGrid" columns="1" width="330px">
            
             <rich:extendedDataTable id="liquidityDataTable"
             selectionMode="single"
             value="#{liquidityDataTableController.dataModel}"
             var="item"
             height="300px"
             >
             <f:facet name="header">
             <h:outputText value="Execution Priority" />
             </f:facet>
             <rich:column id="lpNameCol"
             label="Liquidity Provider"
             sortable="true"
             sortBy="#{item.partyNm}"
             >
             <f:facet name="header">
             <h:outputText value="Liquidity Provider" />
             </f:facet>
             <h:outputText value="#{item.partyNm}" />
             </rich:column>
            
             <rich:column id="lpScoreCol"
             label="Score"
             sortable="true"
             sortBy="#{item.rankNum}"
             style="text-align: right;"
             >
             <f:facet name="header">
             <h:outputText value="Score" />
             </f:facet>
             <h:outputText value="#{item.rankNum}" />
             </rich:column>
            
             <rich:column id="lpPartCol"
             label="Participating"
             sortable="true"
             sortBy="#{item.participatingFg}"
             style="text-align: center;"
             >
             <f:facet name="header">
             <h:outputText value="Participating" />
             </f:facet>
             <h:selectBooleanCheckbox value="#{item.participatingFg}" disabled="true">
             </h:selectBooleanCheckbox>
             </rich:column>
            
             </rich:extendedDataTable>
            
             <a4j:commandButton value="Edit"
             styleClass="commandButton"
             reRender="liquidityModalPanel"
             binding="#{liquidityDataTableController.editButton}"
             action="#{liquidityModalPanelController.setEditMode}"
             oncomplete="javascript:Richfaces.showModalPanel('liquidityModalPanel');"
             />
            
             </h:panelGrid>
            
             </h:form>
            
             <a4j:include viewId="liquidityModalPanel.jspx" />
            
             </ui:composition>
            </body>
            </html>
            


            Michael

            • 3. Re: java.util.NoSuchElementException

              This error occurs when the <f:selectItems> tag has a different value when it was rendered and at the time of submission the value of <f:selectItems> is different. In other words, the selectItems change in between the response and request.

              • 4. Re: java.util.NoSuchElementException
                ilya_shaikovsky

                waht is the scope of liquidityDataTableController?

                • 5. Re: java.util.NoSuchElementException

                  session scope

                  • 6. Re: java.util.NoSuchElementException
                    ilya_shaikovsky

                    bindings should be request scoped.

                    • 7. Re: java.util.NoSuchElementException

                      I am still getting this error but intermittently and we have a customer demo on the horizon. Sometimes the page renders ok - Sometimes not. Can you please explain why the beans should be request scope?

                      Rgds,

                      Michael

                      • 8. Re: java.util.NoSuchElementException
                        nbelaevski

                        Hi Michael,

                        All JSF components are designed for single-thread access. Placing component to session, you open the door to all sort of concurrent access issues (like the one you get). Another reason is that components are not Serializable, but all session-scoped objects in distributable application has to be so.

                        • 9. Re: java.util.NoSuchElementException

                          Hi,

                          Changing all of my controller beans to request scope would not work because I need the controllers to hold state across requests e.g. User selections, button enable/disable, bean values etc. This would be lost if I change them all to request scope.

                          Rgds,

                          Michael

                          • 10. Re: java.util.NoSuchElementException
                            nbelaevski

                            Separate this into two parts: one stored in request scope, another in session; inject the second into first.

                            Why do you need binding at all?

                            • 11. Re: java.util.NoSuchElementException

                              Please can you help us out with this question?

                              • 12. Re: java.util.NoSuchElementException
                                ilya_shaikovsky

                                read the post above.

                                • 13. Re: java.util.NoSuchElementException

                                  I have beans in session scope because they hold data that I don't want to initialise on each request, e.g. a list of values displayed in a table or state about a component. Like commandButtons that need enabling/disabling, or f:selectItems lists on backing beans.

                                  • 14. Re: java.util.NoSuchElementException
                                    nbelaevski

                                    No problem. Why binding?

                                    1 2 Previous Next