8 Replies Latest reply on Jun 25, 2003 3:10 PM by warrenc5

    Scheduler and ClassCastException

    Tim Yates Newbie

      Hi there jboss experts :-)

      I have a problem... I have a scheduler task, which runs every hour, to import some data into an auxilliary database. This Scheduler task has to get a reference to one of my EJBs. This works fine the first time I run it, but if I redeploy my EJB jar, I keep getting the following exception:

      2003-06-06 16:27:30,055 ERROR [STDERR] java.lang.ClassCastException
      2003-06-06 16:27:30,056 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
      2003-06-06 16:27:30,056 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
      2003-06-06 16:27:30,056 ERROR [STDERR] at org.picr.vice.mbean.SQLImporterScheduler.fetchImagehome(SQLImporterScheduler.java:47)
      2003-06-06 16:27:30,056 ERROR [STDERR] at org.picr.vice.mbean.SQLImporterScheduler.perform(SQLImporterScheduler.java:110)
      2003-06-06 16:27:30,056 ERROR [STDERR] at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1046)
      2003-06-06 16:27:30,057 ERROR [STDERR] at org.jboss.mx.server.NotificationListenerProxy.handleNotification(NotificationListenerProxy.java:71)
      2003-06-06 16:27:30,057 ERROR [STDERR] at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:84)
      2003-06-06 16:27:30,057 ERROR [STDERR] at javax.management.timer.Timer.sendNotifications(Timer.java:441)
      2003-06-06 16:27:30,057 ERROR [STDERR] at javax.management.timer.Timer.access$000(Timer.java:31)
      2003-06-06 16:27:30,057 ERROR [STDERR] at javax.management.timer.Timer$RegisteredNotification.doRun(Timer.java:612)
      2003-06-06 16:27:30,057 ERROR [STDERR] at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:164)
      2003-06-06 16:27:30,058 ERROR [STDERR] at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:225)

      No matter what I try to do to get the proper class;

      ImageHome.class ;
      Class.forName( "ImageHome" ) ;
      Class.forName( "ImageHome" ).newInstance().getClass() ;

      I still get the ClassCastException until I restart JBoss, then it all seems to work properly again... It's as if the classpath is getting "stuck" with the old version of ImageHome... But then again, even if I don't change the Image EJB, and just redeploy I still get the same problem :-(

      Hope someone can help me :-)

      Thanks!

      Tim Yates