2 Replies Latest reply on Jan 26, 2010 10:26 AM by Bernard Labno

    DataScrollerEvent and Classloader Issue

    Drew Kutchar Newbie

      I get the following ClassCastException:

      ClassCastException: Cannot cast org.richfaces.event.DataScrollerEvent to org.richfaces.event.DataScrollerEvent

      When calling:

      <rich:datascroller align="left" for="table" actionListener="#{action.scrollListener}"/>

      public void scrollListener(final ActionEvent event) {
           final DataScrollerEvent scrollerEvent = (DataScrollerEvent) event;
           log.info("scroll #0 #1", scrollerEvent.getNewScrolVal(), scrollerEvent.getOldScrolVal());

      I did a grep for DataScrollerEvent at the root of my project and this is what I got:

      Binary file exploded-archives/GotPrintSeam.ear/lib/richfaces-api.jar matches
      Binary file exploded-archives/GotPrintSeam.war/WEB-INF/lib/richfaces-ui.jar matches
      Binary file lib/richfaces-api.jar matches
      Binary file lib/richfaces-ui.jar matches

      Why are there two versions of the same class in separate jars? JBoss uses different classloaders for loading the libs in the war and the ear so I think that's what's causing the problem. Since my action is a SFSB it's loaded using the EAR classloader and I think the RichFaces is loaded using the WAR classloader.

      Is this a bug? Is there a fix/workaround?

      I am using Seam 2.0.1.GA with RichFaces that was bundled with 2.0.1.GA and JBoss 4.2.2.GA