6 Replies Latest reply on Jun 8, 2007 6:12 AM by grdzeli_kaci

    Richfaces Tree Error (ClassCastException)

      hi all, i am trying to use this component, i have also developers guide,
      i have created 4 beans, from the example:
      1.Library
      2.Album
      3.Artist
      4Song
      after this i adder Library class into my faces-config.xml

       <managed-bean>
       <managed-bean-name>library</managed-bean-name>
       <managed-bean-class>com.liliko.billing.businesslayer.beans.common.Library</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
      


      then i added Richfaces jar into my application.xml as module:

       <module>
       <java>richfaces-3.0.1-SNAPSHOT.jar</java>
       </module>
      


      after all my client code looks like :

      <h:form id="menuId">
       <rich:tree style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}">
       <rich:treeNode type="library">
       <h:outputText value="#{item.type}" />
       </rich:treeNode>
       <rich:treeNode type="artist">
       <h:outputText value="#{item.name}" />
       </rich:treeNode>
       <rich:treeNode type="album">
       <h:outputText value="#{item.title}" />
       </rich:treeNode>
       <rich:treeNode type="song">
       <h:outputText value="#{item.title}" />
       </rich:treeNode>
       </rich:tree>
       </h:form>
      


      but i got an error like this :
      java.lang.ClassCastException: com.liliko.billing.businesslayer.beans.common.Library
       at org.richfaces.component.AbstractTreeDataModel.setWrappedData(AbstractTreeDataModel.java:63)
       at org.richfaces.component.UITree.createDataModel(UITree.java:497)
       at org.richfaces.component.UITree.createDataModel(UITree.java:520)
       at org.ajax4jsf.ajax.repeat.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:522)
       at org.ajax4jsf.ajax.repeat.UIDataAdaptor.setRowKey(UIDataAdaptor.java:302)
       at org.ajax4jsf.ajax.repeat.UIDataAdaptor.setRowKey(UIDataAdaptor.java:287)
       at org.richfaces.renderkit.TreeRendererBase.writeContent(TreeRendererBase.java:389)
       at org.richfaces.renderkit.TreeRendererBase.encodeChildren(TreeRendererBase.java:283)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
      
      

      Library class isntance of org.richfaces.component.TreeNode,
      Why i got ClassCastException?

      there is not any nested exceptions,

      can anybody help me ?
      Regards,
      Paata.

        • 1. Re: Richfaces Tree Error (ClassCastException)

          is there anybody who can help me ?
          is anybody use tree component ?

          • 2. Re: Richfaces Tree Error (ClassCastException)

            Please, use the release version of RichFaces, not 3.0.1-SNAPSHOT.

            And post your appearance, please.

            • 3. Re: Richfaces Tree Error (ClassCastException)

              ok, tried to use jboss richfaces 3.0 but i got the same error,
              my apparance is :
              1. JBoss 4.2.0GA Application Server
              2. JBoss Seam Project
              3. Also I use facelets
              4.and of course ajax4jsf

              but i got the same error, ather components wors fine, i think maybe i have something incorrect, beans i got from example, also i got usage example from developers guide, but could not resolve this issue.

              • 4. Re: Richfaces Tree Error (ClassCastException)

                usually ClassCastException appears because of the correlation with other version of the same library loaded in the same Jboss server.

                • 5. Re: Richfaces Tree Error (ClassCastException)
                  kosmos

                  The solution is to set false to true for attributes

                  <attribute name="Java2ClassLoadingCompliance">true</attribute>
                  <attribute name="UseJBossWebLoader">true</attribute>

                  in
                  \server\default\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml

                  • 6. Re: Richfaces Tree Error (ClassCastException)

                     

                    "kosmos" wrote:
                    The solution is to set false to true for attributes

                    <attribute name="Java2ClassLoadingCompliance">true</attribute>
                    <attribute name="UseJBossWebLoader">true</attribute>

                    in
                    \server\default\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml


                    thank you, i have done this and another problem,
                    1. if i have richfaces-3.0.1-SNAPSHOT.jar all works fine, tree seems fine but when i tried to expand some node i got large and strange error:

                    01:52:01,483 FATAL [renderkit] org.richfaces.component.TreeRowKey; local class incompatible: stream classdesc serialVersionUID = -5575315920637054787, local class serialVersionUID = -4512368247744836825
                    java.io.InvalidClassException: org.richfaces.component.TreeRowKey; local class incompatible: stream classdesc serialVersionUID = -5575315920637054787, local class serialVersionUID = -4512368247744836825
                     at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
                     at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
                     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
                     at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
                     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
                     at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
                     at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
                    ...............................................................................................................
                    ...............................................................................................................
                    Caused by: java.io.InvalidClassException: org.richfaces.component.TreeRowKey; local class incompatible: stream classdesc serialVersionUID = -5575315920637054787, local class serialVersionUID = -4512368247744836825
                     at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
                     at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
                     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
                     at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
                    
                    


                    2. if i change richfaces version to richfaces-3.0.0 i did not get any error but tre is not working (does not have any action exapand etx..) and text also is not shown :(,


                    Please help me :(

                    Regards,
                    Paata.