0 Replies Latest reply on Dec 20, 2012 3:57 AM by David Poliacek

    Component binding to session scoped bean problem ?

    David Poliacek Newbie

      Hi guys,

      I am workking on some project who uses JSF-api 1.2, My Faces 1.2.8, RichFaces 3.3.3.Final, Tomahawk 1.1.10, JSF-facelets 1.1.14.

       

      When users use our application time to time occure these exceptions:

       

      1.

      java.lang.IllegalStateException: duplicate Id for a component leftnav_form:j_id134

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:68)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:92)

          at org.ajax4jsf.application.AjaxStateManager.getTreeStructureToSave(AjaxStateManager.java:189)

          at org.ajax4jsf.application.AjaxStateManager.buildViewState(AjaxStateManager.java:514)

          at org.ajax4jsf.application.AjaxStateManager.saveSerializedView(AjaxStateManager.java:467)

          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 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.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)

          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)

          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)

       

      2.

      I am using rich:panelMenu, and time to time on page reload it disappear.

       

      <h:form id="leftnav_form">

       

         <rich:panelMenu id="leftnav_menu" mode="ajax" expandMode="ajax" binding="#{menuState.pm}">

       

            <rich:panelMenuGroup id="grp1"

              label="#{res['menu.search']}">

       

              <rich:panelMenuItem id="mnuId1"

                label="#{res['menu.search.search1']}"

                action="#{webSharedBean.goMenu}">

                <f:param name="navigatedMethod" value="myBean.menuInit" />

              </rich:panelMenuItem>

       

              <rich:panelMenuItem id="mnuId2"

                label="#{res['menu.search.search2']}"

                action="#{webSharedBean.goMenu}">

                <f:param name="navigatedMethod"

                  value="myBean.menuInit" />

              </rich:panelMenuItem>

       

            </rich:panelMenuGroup>

       

          </rich:panelMenu>

      </h:form>

       

      Component binding on panelMenu is to session scoped bean. It is possible hold state of panelMenu betwean two pages or page reload without component binding?

      I found https://issues.jboss.org/browse/RF-6545, but when I remove component binding or chnge bean scope from session to request the state of panel menu between two page navigation is lost.

      Please if you have some advice please let me know.

       

      3.

      javax.faces.FacesException: Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /jsf/vystupne/xxx.jsp][Class: org.apache.myfaces.custom.div.Div,Id: j_id6][Class: org.apache.myfaces.custom.div.Div,Id: j_id39][Class: org.apache.myfaces.custom.div.Div,Id: j_id40][Class: org.apache.myfaces.custom.div.Div,Id: j_id43][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id44]}

          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:627)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:261)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)

          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)

          at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)

          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)

       

          ...

       

      Caused by: java.util.NoSuchElementException

          at java.util.AbstractList$Itr.next(AbstractList.java:350)

          at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:510)

          at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:532)

          at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)

          at org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:92)

       

      4.

      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.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
      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.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
      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.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:83)
      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.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:685)
      at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:556)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:250)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      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:187)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1329)
      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)

       

       

      Summary:

      In our app time to time we have two kinds of exception.

      a) java.lang.IllegalStateException: duplicate Id for a component

      b) java.util.NoSuchElementException

       

      It is little it difficult simulate this, because how i said it occur only time to time, but if exception occurs the frequency of exceptions rise.

       

      We uses component binding to session scoped bean a lot. I think this can bea our prob? What do you think?

       

      Second bug prob is how manage state of rich:panelMenu without component binding to session scoped bean.

       

      Thanks a lot for your advice.

       

      I hope that live someone who knows this old staff