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;
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 :-)
Oooops... forgot to mention that I am using JBoss 3.0.7 :-)
Thanks again for *any* help :-)
I just upgraded to jboss 3.0.8
The problem still exists :-(
Haven't tried this, but can't you redeploy your scheduler task by making it dependent on your EJB jar (by creating a SAR)?
The problem will be that the class image has bounced from being unloaded and reloaded but probably your scheduler task is referencing the invalidated copy.
> Haven't tried this, but can't you redeploy your scheduler task by making it dependent on your EJB jar (by creating a SAR)?
Errr... are there any tutorials on making a sar directory out there?
I take it SARs are Service Archives? How would I go about combining my Sheduler and EJB jar into one?
Thanks for the response!! Each one makes my heart feel less heavy :-)
I suggest you look in the JBoss directories themselves ($JBOSS/server/all/deploy) -- you can see several ".sar"s there.
You can bundle .sars and EJB .jars into a single EAR. The dynamic deployment feature makes it easy to test.
Yay! Got that working! :-)
It's cool now, that it doesn't try to access the EJBs before deployment, or during redeployment...
Still get a classcastexception when the scheduler tries to access the EJBs after a redeploy, but I managed to *squeeze* round this problem by catching the exception on the PortableRemoteObject.narrow, and if it does get caught, I use JMX to redeploy the scheduler ;-)
Ahhh... hack tastic ;-)
Would still like to know why this happens... I am confused as to whether it is a JBoss or JDK 1.4.2 on linux bug... There seems to be different stories from different sources...
I guess time will tell...I'll have to be proud of my hack till then ;-)
Thanks all :-)
Would that possible to share your code, or at least tell us how your SAR 'talk' to EJB ?
i get a very similar error when i switched from sun javac to using the ibm jikes compiler. I am about to throw in some serial UIDs into my classes.
well actually as I have 16 million ejbs I'm going to use jalopy.