4 Replies Latest reply: Jun 8, 2012 8:46 AM by Shane Humes RSS

Intermittent ClassCastException in internal Class StackingTr

Patrick Madden Newbie

Hi, I have a problem that is hard to reproduce but it is reproducible. I have a navigation tree on the left and a content pane on the right. The tree is dynamic in that it grows based on a user query. It all works great pretty much. However, if I simply stay focused on the tree and go back and forth expanding and collapsing nodes after a while I get the following exception:


javax.faces.FacesException: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.richfaces.model.StackingTreeModel$Key


javax.faces.FacesException: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.richfaces.model.StackingTreeModel$Key
 at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:457)
 at org.ajax4jsf.component.UIDataAdaptor.encodeAjaxChild(UIDataAdaptor.java:456)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:105)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
 at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
 at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
 at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:673)
 at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:544)
 at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
 at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
 at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
 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 com.clooster.web.filter.JarFilter.doFilter(JarFilter.java:89)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
 at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
 at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
 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:432)
 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.richfaces.model.StackingTreeModel$Key
 at org.richfaces.model.StackingTreeModel.doSetupKey(StackingTreeModel.java:137)
 at org.richfaces.model.StackingTreeModel.setupKey(StackingTreeModel.java:175)
 at org.richfaces.model.StackingTreeModel.setRowKey(StackingTreeModel.java:468)
 at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:352)
 at org.richfaces.renderkit.TreeRendererBase.encodeAjaxChildren(TreeRendererBase.java:424)
 ... 61 more


I'm using 3.2.1.GA but this also occurred intermittently in previous releases.

My tree is built using rich:tree and a series of rich:treeNodes. Internally in my TreeNodeImpl I do use Integer as an object ID of the nodes. I don't see how I'm doing anything wrong but is it possible this is a RF Bug?

Any help is greatly appreciated,

Thanks,

PVM

  • 1. Re: Intermittent ClassCastException in internal Class StackingTr
    Matthias Reusch Newbie

    Hello,

     

    i have a similar problem with 3.3.1.GA.

     

    Knows someone a solution to this problem.

     

    java.lang.ClassCastException: java.lang.Integer cannot be cast to org.richfaces.model.StackingTreeModelKey
         at org.richfaces.model.StackingTreeModel.doSetupKey(StackingTreeModel.java:153)
         at org.richfaces.model.StackingTreeModel.setupKey(StackingTreeModel.java:191)
         at org.richfaces.model.StackingTreeModel.setRowKey(StackingTreeModel.java:497)
         at org.richfaces.model.StackingTreeModel.setRowKey(StackingTreeModel.java:493)
         at org.ajax4jsf.component.UIDataAdaptorBase.setRowKey(UIDataAdaptorBase.java:351)
         at org.ajax4jsf.component.UIDataAdaptorBase.setRowKey(UIDataAdaptorBase.java:324)
         at org.richfaces.renderkit.TreeRendererBase.getSelectionValue(TreeRendererBase.java:528)
         at org.richfaces.renderkit.TreeRendererBase.encodeSelectionStateInput(TreeRendererBase.java:553)
         at org.richfaces.renderkit.html.TreeRenderer.doEncodeEnd(TreeRenderer.java:236)
         at org.richfaces.renderkit.html.TreeRenderer.doEncodeEnd(TreeRenderer.java:253)
         at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:134)
         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:624)
         at javax.faces.component.UIData.encodeEnd(UIData.java:779)
         at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:534)
         at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:511)
         at org.apache.myfaces.renderkit.html.ext.HtmlGroupRenderer.encodeEnd(HtmlGroupRenderer.java:71)
         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:624)
         at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:281)
         at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
         at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:301)
         at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:296)
         at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
         at org.richfaces.renderkit.html.SimpleTogglePanelRenderer.encodeChildren(SimpleTogglePanelRenderer.java:188)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:611)
         at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
         at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:166)
         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.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.UIAjaxRegion.encodeAjax(UIAjaxRegion.java:263)
         at org.ajax4jsf.component.AjaxViewRoot$4.invokeContextCallback(AjaxViewRoot.java:497)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:163)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:293)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:172)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:293)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:172)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:293)
         at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:172)
         at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:293)
         at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:551)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:250)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.actuallyRenderView(JspViewHandlerImpl.java:427)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:383)
         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 org.apache.myfaces.custom.ppr.PPRLifecycleWrapper.render(PPRLifecycleWrapper.java:84)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:182)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:384)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         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:388)
         at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
         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:293)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
         at java.lang.Thread.run(Thread.java:619)

     

    Thanks in advance

    Matthias

  • 3. Re: Intermittent ClassCastException in internal Class StackingTr
    Matthias Reusch Newbie

    Hi Ilya,

     

    thanks for your fast reply.

     

    I think i have fixed the problem. On response my tree object was null. I have killed it instead of flush it.

     

    Creating a new instance, now all looks fine.

     

    You do a great job, my deep respect.

     

    Matthias

  • 4. Re: Intermittent ClassCastException in internal Class StackingTr
    Shane Humes Newbie

    I am having the same problem.  I just found this post, but, in reading it, I am not sure what the solution was.  I am getting this exception when I set the tree = null to reset the managed bean.  I looked and did not see a flush method.  Any help would be appreciated.

     

    Shane