2 Replies Latest reply on Jun 6, 2007 5:50 PM by Patrick Madden

    Very Strange Problem

    Patrick Madden Newbie

      Hi,

      I have a strange problem with the tree control. Its been working for a long time but I recently updated to the lastest cvs version of Seam and JBoss 4.2.0.GA. I have the SVN source from June 4th of Ajax4Jsf and Rich Faces. Everything seems to be working on my site except the tree control. I get a class cast exception on line 63 of org.richfaces.component.AbstractTreeDataModel. The code is as follows:

      public final void setWrappedData(Object data){
       wrappedData = (TreeNode) data;
      }
      


      The class cast exception indicated that I was trying to assign a TreeNodeImpl instance to the wrapped data. This is correct and as designed right?

      Anyway, I went in and modified the code to look like this:


       public final void setWrappedData(Object data)
       {
       if (data instanceof org.richfaces.component.TreeNode)
       {
       wrappedData = (org.richfaces.component.TreeNode) data;
       }
       else
       {
       System.out.println("***** WARNING *******");
       System.out.println("Trying to set TreeNode data using " + data.getClass().getName());
      
       //wrappedData = data;
       wrappedData = null;
       }
       }
      


      And when I run my site here is the warning that is printed out.


      16:42:36,145 INFO [STDOUT] ***** WARNING *******
      16:42:36,145 INFO [STDOUT] Trying to set TreeNode data using org.richfaces.component.TreeNodeImpl


      Anyone have any ideas as to why I can't cast a TreeNodeImpl to a TreeNode? Doesn't make any sense. I have cleared my cache and all that numerous times.

      Any help is greatly appreciated.

      Thanks,

      PVM

        • 1. Re: Very Strange Problem
          Patrick Madden Newbie

          Just an FYI - I went ahead and downloaded the ajax4jsf-1.1.1.jar and the richfaces-3.0.1.jar listed on the Most Important Links page. I'm assuming these are GA jar's. I still get the same problem. Here is the full stack trace of the problem. As you can see the ClassCastException indeed indicates that object that is trying to be casted is a TreeNodeImpl which implements TreeNode. So this doesn't make sense to me at all.

          SEVERE: Error Rendering View[/search.xhtml]
          java.lang.ClassCastException: org.richfaces.component.TreeNodeImpl
          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:393)
          at org.richfaces.renderkit.TreeRendererBase.encodeChildren(TreeRendererBase.java:284)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
          at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:282)
          at org.ajax4jsf.framework.renderer.RendererBase.renderChildren(RendererBase.java:262)
          at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:189)
          at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:184)
          at org.ajax4jsf.framework.renderer.RendererBase.encodeChildren(RendererBase.java:121)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
          at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
          at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
          at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
          at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233)
          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
          at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:59)
          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:60)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:293)
          at org.jboss.seam.web.AbstractAjax4jsfFilter.doFilter(AbstractAjax4jsfFilter.java:35)
          at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
          at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:126)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
          at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          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:230)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:595)

          Again, Any help is appreciated.

          Thanks,

          PVM

          • 2. Re: Very Strange Problem
            Patrick Madden Newbie

            Ok, I figured it out finally. I figured it had to be some kind of class loading issue and then I remembered the switches in the jboss web deployer service.xml located at $JBOSS_HOME/server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml

            You need to set two flags to true as follows:

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


            By default they are set to false. Once I set them to true the system works as advertised.

            Thanks,

            PVM