we are using jboss 3.2.2, win 2k, mySQL 4.0.13.

I've developed a simple implementation of the Schedulable interface. Packed
it into a sar together with a jboss-service.xml. This sar is packed into the
ear (together with a jboss-app.xml) of my application that should be
triggered by the Scheduler. Deploying the ear with the DueDateScheduler
mbean works great for the first time. But when I'm redeploying the ear I get
a java.lang.ClassCastException every time the Scheduler is called:

2003-11-17 15:49:20,799 ERROR
[com.cargosoft.scmtool.server.services.mbean.DueDateScheduler]
DueDateScheduler::perform(date, param) 4711 abgebrochen:
java.lang.ClassCastException
        at
com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemo
teObject.java:293)
        at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
        at
com.cargosoft.scmtool.server.services.mbean.DueDateScheduler.getTimeSchedule
r(DueDateScheduler.java:49)
        at
com.cargosoft.scmtool.server.services.mbean.DueDateScheduler.perform(DueDate
Scheduler.java:37)
        at
org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.ja
va:1263)
        at
org.jboss.mx.server.NotificationListenerProxy.handleNotification(Notificatio
nListenerProxy.java:69)
        at
javax.management.NotificationBroadcasterSupport.sendNotification(Notificatio
nBroadcasterSupport.java:95)
        at javax.management.timer.Timer.sendNotifications(Timer.java:441)
        at javax.management.timer.Timer.access$000(Timer.java:31)
        at
javax.management.timer.Timer$RegisteredNotification.doRun(Timer.java:612)
        at
org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:164)
        at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:225)

Even when I restart the Scheduler mbean via jmx-console the errore stays the
same. Only a restart of the server (with the ear ramining deployed) is a way
out of this problem. But I can't restart our production server every time I
update the application!


What did I wrong? Any hints?


Thanks in advance...


Source:

public class DueDateScheduler implements Schedulable {
    protected static Logger logger;

    {
        logger = Logger.getLogger(DueDateScheduler.class);
    }

    private String testArg;

    public DueDateScheduler(String arg0) {
        testArg = arg0;
    }

    public void perform(java.util.Date date, long param) {
        try {
            getTimeScheduler().checkDueDates();
            logger.info("DueDateScheduler::perform(date, param) " + testArg
+ " ausgef�hrt");
        }
        catch (Exception ex) {
            logger.error("DueDateScheduler::perform(date, param) " + testArg
+ " abgebrochen:", ex);
        }
    }

    private TimeScheduler getTimeScheduler() throws Exception {
        Context ctx = getJBossInitialContext();
        Object ref = ctx.lookup("SCMTool/TimeScheduler");

        TimeSchedulerHome timeSchedulerHome = (TimeSchedulerHome)
            PortableRemoteObject.narrow(ref, TimeSchedulerHome.class);
        return timeSchedulerHome.create();
    }

    private javax.naming.Context getJBossInitialContext() throws
NamingException {
        java.util.Hashtable JNDIParm = new java.util.Hashtable();
        JNDIParm.put(Context.PROVIDER_URL, "localhost");
        JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
        return new InitialContext(JNDIParm);
    }

}


-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to