4 Replies Latest reply on Oct 23, 2009 2:47 PM by Maurice ubom

    a4j:push (java.lang.ClassCastException)

    Maurice ubom Newbie

      Hi All,
      Please I am trying to implement ajax push using a4j:push, i have this error when the page load. This is the example code from Rich Faces demo. I am using jboss Server 5.00, Seam 2.1.2, RF 3.2.2 and Java 1.6.
      Please can anyone help me, thanks.

      Below is an exception

      /push.xhtml @19,51 eventProducer="#{push.addListener}": java.lang.ClassCastException: org.ajax4jsf.webapp.PushEventsCounter cannot be cast to org.ajax4jsf.event.PushEventListener

      below are xhtml file and Java file


      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a="http://richfaces.org/a4j"
      xmlns:a4j="http://richfaces.org/a4j"
      template="layout/template.xhtml">

      <ui:define name="body">

      <h:form>

      <a4j:push eventProducer="#{push.addListener}"
      enabled="#{push.enabled}" id="push"/>



      </h:form>


      </ui:define>
      </ui:composition>




      import java.util.Date;
      import java.util.EventListener;
      import java.util.EventObject;
      import java.util.UUID;
      import org.jboss.seam.annotations.Name;
      import org.ajax4jsf.webapp.PushEventsCounter;
      import org.ajax4jsf.event.PushEventListener;




      @Name("push")
      public class PushBean implements Runnable {


      private PushEventListener listener;
      private Thread thread;


      public void addListener(EventListener listener) {
      synchronized (listener) {
      if (this.listener != listener) {


      this.listener = (PushEventListener) listener;

      }
      }
      }