0 Replies Latest reply on Dec 8, 2008 11:00 AM by Carlos Oliva

    Using same job class in Quartz scheduler

    Carlos Oliva Novice

      How can I use the same class as a quartz job in Quartz? I am creating quartz jobs with the quartz implementaion of JBoss 4.2.3.GA. From a web object I add the job to the scheduler and create the cron. I add the job class name in the job detail as follows:
      org.quartz.JobDetail jd = new org.quartz.JobDetail("myjob",sched.DEFAULT_GROUP, NewJob.class);
      I want to use the same job class (NewJob.class) with different parameters in the job detail and add it to the scheduler with a adifferent cron trigger but Quartz errors out saying that the class is already in use. I must create a copy of the job class with a different name and then I can successfuly schedule the jobs. The job class is just calling different web objects depending on the parameters of the job detail but the code of the class is the same in the two copies of the job class. I want to avoid creating the same class with different names everytime that I have to schedule one of these calls.