7 Replies Latest reply on Dec 7, 2007 10:56 AM by Peter Brewer

    ERROR TreeRendererBase.encodeAjaxChildren()

    Enrico Gulfi Newbie

      We are using RichFaces 3.1.2 (bundled with Seam 2.0.0) to display an object hierarchy. The page code is the following:

      <rich:tree
       nodeSelectListener="#{treeManager.processSelection}"
       ajaxSubmitSelection="true"
       ajaxSingle="true"
       switchType="client"
       reRender="contentRegion"
       value="#{treeManager.data}"
       var="item"
       nodeFace="#{item.type}">
       <rich:treeNode type="library">
       <h:outputText value="#{item.type}" />
       </rich:treeNode>
       <rich:treeNode type="folder">
       <h:outputText value="#{item.id} #{item.descr}" />
       </rich:treeNode>
       <rich:treeNode type="subfolder">
       <h:outputText value="#{item.id} #{item.descr}" />
       </rich:treeNode>
       <rich:treeNode type="document">
       <h:outputText value="#{item.id} #{item.descr}" />
       </rich:treeNode>
      </rich:tree>

      treeManager.processSelection for now simply logs some info on screen. The problem we face is that by clicking on any node the following error message is printed on screen:
      ERROR [STDERR] TreeRendererBase.encodeAjaxChildren()[2]
      

      "2" seams to correspond to the position of the associated node of type "folder" among similar nodes. Moreover, treeManager.processSelection is not called as nothing from it is logged.

      Does anybody know what is causing this behaviour?

      Many thanks, Enrico

        • 1. Re: ERROR TreeRendererBase.encodeAjaxChildren()
          Peter Brewer Novice

          I'm using Seam 2GA with Richface3.1.2GA and I am seeing exacting the same error in the logs:

          10:09:53,291 ERROR [STDERR] TreeRendererBase.encodeAjaxChildren()[1:6]
          


          However, it doesn't seem to impact on functionality. Is this a logging bug introduced by 3.1.2 - or is there really an issue that should be addressed?

          I agree with Enrico, it would be good to know what causes this behaviour?

          Thanks, Peter.

          • 2. Re: ERROR TreeRendererBase.encodeAjaxChildren()
            Enrico Gulfi Newbie

            Peter,

            However, it doesn't seem to impact on functionality.

            Good for you! In our case the nodeSelectionListener is not called.

            Is there another way to execute a bean action upon selection, in which we can retrieve the selected node? Are you using the same combination of rich:tree attributes in your application?

            Thanks, Enrico

            • 3. Re: ERROR TreeRendererBase.encodeAjaxChildren()
              Peter Brewer Novice

              Hi Enrico, here's my tree code:

               <rich:tree value="#{tree.model}" var="item"
               switchType="ajax"
               nodeFace="#{item.structureNode.id}"
               nodeSelectListener="#{tree.nodeSelected}"
               reRender="mainOutputPanel"
               changeExpandListener="#{tree.nodeExpansionChanged}"
               ajaxSubmitSelection="true">
              
               <rich:treeNode type="#{item.structureNode.id}">
               <h:outputText value="#{item.text}" />
               </rich:treeNode>
               </rich:tree>
              



              It's almost identical to yours except I use switchType="ajax" and I do not use ajaxSingle="true".

              Perhaps you could try changing those attributes just to see if your tree will submit the selection?

              Also, what does your selection method look like on the back-end, it should be something like:
              public void nodeSelected(NodeSelectedEvent event) {
               ...
              }
              


              Hope this helps,
              Peter.

              • 4. Re: ERROR TreeRendererBase.encodeAjaxChildren()
                Enrico Gulfi Newbie

                Peter,

                thanks for your advice. By following your advice the nodeSelectListener gets called. BTW, mine looks as following:

                public void processSelection(NodeSelectedEvent event) {
                 log.info("selected node"); // 1
                 UIComponent component = event.getComponent(); // 2
                }

                If remove line 2, I get the message logged as expected. As soon as I add line 2 I get the following messages logged:
                16:16:50,859 INFO [TreeManagerAction] selected node
                16:16:50,875 WARN [lifecycle] /home.xhtml @25,29 nodeSelectListener="#{treeManager.processSelection}": javax.ejb.EJBTransactionRolledbackException
                16:16:51,172 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.sourceId=null[severity=(WARN 1), summary=(Transaction failed), detail=(Transaction failed)]
                

                Somehow, it can not retrieve the selected node... Does it suggest you anything?

                Many thanks, Enrico

                • 5. Re: ERROR TreeRendererBase.encodeAjaxChildren()
                  Enrico Gulfi Newbie

                  One additional question: to work around some NoClassDefFoundErrors I was getting when initially deploying the project (created with seam-gen), e.g.,

                  18:51:30,328 ERROR [[/testtree]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
                  java.lang.RuntimeException: Could not create Component: treeManager
                  ...
                  Caused by: java.lang.NoClassDefFoundError: org/richfaces/component/UITree
                  ...
                  

                  I had copied the richfaces-xxx.jars in the jboss server/lib directory. That removed the runtime exceptions, but I suspect it introduced the javax.ejb.EJBTransactionRolledbackException described above.

                  Question: Where are your richfaces jars located?

                  Thanks again, Enrico


                  • 6. Re: ERROR TreeRendererBase.encodeAjaxChildren()
                    Enrico Gulfi Newbie

                    After some debugging I finally got it to work! The solution was to

                    - copy the three richfaces jars in the <jboss-installation>/server/default/lib, and to

                    - instruct jboss to use its own class loader instead of tomcat class loader for wars, by setting UseJBossWebLoader to true in <jboss-installation>/server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml

                    Since this workaround is not really in line with the J2EE standard, I guess there is still an issue with the way richfaces jars are packaged.

                    Regards, Enrico

                    • 7. Re: ERROR TreeRendererBase.encodeAjaxChildren()
                      Peter Brewer Novice

                      Sorry for the late reply to your questions (I thought I was watching this topic, but obviously not).

                      If you're using Seam 2 with jboss 4.2.1 then then you can place the three richfaces files into the lib directory of the ear file to make them available to web and application code. e.g.

                      myApp.ear
                      |
                      |-META-INF
                      |
                      |-myApp.war
                      |
                      |-myApp.jar
                      |
                      |-etc
                      |
                      |-lib
                      | |-richfaces-api-xxx.jar
                      | |-richfaces-impl-xxx.jar
                      | |-richfaces-ui-xxx.jar
                      | |-etc

                      Thanks, Peter.