Im trying to implement a scheduler to schedule 3 jobs, but on first job implementation only im getting incompatible class change error..
The error is on line,
JobDetail jobA = JobBuilder.newJob(JobA.class)
.withIdentity(jobKeyA).build();
Any help??
the complete code is as follow..
import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;
public class Scheduler1 {
public static void main( String[] args ) throws Exception
{
JobKey jobKeyA = new JobKey("jobA", "group1");
JobDetail jobA = JobBuilder.newJob(JobA.class)
.withIdentity(jobKeyA).build();
JobKey jobKeyB = new JobKey("jobB", "group1");
JobDetail jobB = JobBuilder.newJob(JobB.class)
.withIdentity(jobKeyB).build();
JobKey jobKeyC = new JobKey("jobC", "group1");
JobDetail jobC = JobBuilder.newJob(JobC.class)
.withIdentity(jobKeyC).build();
Trigger trigger1 = TriggerBuilder
.newTrigger()
.withIdentity("dummyTriggerName1", "group1")
.withSchedule(
CronScheduleBuilder.cronSchedule("0/5 * * * * ?"))
.build();
Trigger trigger2 = TriggerBuilder
.newTrigger()
.withIdentity("dummyTriggerName2", "group1")
.withSchedule(
CronScheduleBuilder.cronSchedule("0/5 * * * * ?"))
.build();
Trigger trigger3 = TriggerBuilder
.newTrigger()
.withIdentity("dummyTriggerName3", "group1")
.withSchedule(
CronScheduleBuilder.cronSchedule("0/5 * * * * ?"))
.build();
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
scheduler.start();
scheduler.scheduleJob(jobA, trigger1);
scheduler.scheduleJob(jobB, trigger2);
scheduler.scheduleJob(jobC, trigger3);
}
}
i have three classes jobA,jobB,jobC but when im adding them to above scheduler im getting error as follows,
Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:788) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:447) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at Scheduler1.main(Scheduler1.java:15)