views:

48

answers:

0

I have a two jobs in Quartz which will run perfetly well but I find I have to use code like:

jd = new JobDetail(sj.getJobName(), scheduler.DEFAULT_GROUP, PollJob.class);
ct = new CronTrigger(sj.getJobTrigger(), scheduler.DEFAULT_GROUP, "0 20 * * * ?");
        scheduler.scheduleJob(jd, ct);

I have to hardcode PollJob.class to run the job and sj is an object read from the database containing PollJob's details. But I would like to set PollJob.class from the database as well. I've tried casting to a class by:

Class cls = Class.forName(sj.getJobJavaClassFile());
jd = new JobDetail(sj.getJobName(), scheduler.DEFAULT_GROUP, cls));

And using a class reference directly as:

    jd = new JobDetail(sj.getJobName(), scheduler.DEFAULT_GROUP, Class.forName sj.getJobJavaClassFile()));

But the job simply doesn't execute. There are no exceptions generated that I can see and no stack trace?

I'm running a JVM on Windows 7.

Any ideas?

Mr Morgan.