title: How to start a Job with several cron-triggers using the quartz-scheduler?
body: <p>I'm using the <a href="http://quartz-scheduler.org" rel="nofollow">Quartz Scheduler</a> to start jobs in my Java-App. I have the job <code>HelloJob.java</code></p>
  
  <pre><code>package com.stackoverflow.test.java;
  
  import java.util.Date;
  
  import org.quartz.Job;
  import org.quartz.JobExecutionContext;
  import org.quartz.JobExecutionException;
  
  public class HelloJob implements Job {
  
    private String message;
  
    public HelloJob() {
      Date akt = new Date();
      this.message = "Quartz is running (" + akt + ").";
    }
  
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
      System.out.println(this.message);
    }
  
  }
  </code></pre>
  
  <p>I'd like to start this job using two different cron expressions (here: <code>*/5 */3 * * * ?</code> and <code>*/9 */2 * * * ?</code>). I tried the following:</p>
  
  <pre><code>package com.stackoverflow.test.java;
  
  import org.quartz.JobDetail;
  import org.quartz.Scheduler;
  import org.quartz.SchedulerException;
  import org.quartz.Trigger;
  import org.quartz.impl.StdSchedulerFactory;
  import org.quartz.TriggerBuilder;
  import org.quartz.JobBuilder;
  import org.quartz.CronScheduleBuilder;
  
  
  public class TestQuartz {
  
    public static void main(String[] args) {
  
      try {
        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
        scheduler.start();
  
        /* ################################################################### */
  
        JobDetail job = JobBuilder
                        .newJob(HelloJob.class)
                        .withIdentity("job1", "group1")
                        .build();
  
        CronScheduleBuilder sb1 = CronScheduleBuilder
            .cronSchedule("*/5 */3 * * * ?");
        CronScheduleBuilder sb2 = CronScheduleBuilder
            .cronSchedule("*/9 */2 * * * ?");
  
        Trigger trigger = TriggerBuilder
            .newTrigger()
            .withIdentity("trigger1", "group1")
            .startNow()
            .withSchedule(sb1)
            .build();
        Trigger trigger2 = TriggerBuilder
            .newTrigger()
            .withIdentity("trigger2", "group1")
            .startNow()
            .withSchedule(sb2)
            .build();
  
        scheduler.scheduleJob(job, trigger);
        scheduler.scheduleJob(job, trigger2);
  
        /* ################################################################### */
  
        Thread.sleep(10 * 60 * 1000);
        System.out.println("FIN");
  
        /* ################################################################### */
  
        scheduler.shutdown();
  
      } catch (SchedulerException se) {
        se.printStackTrace();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
  
    }
  }
  </code></pre>
  
  <p>I receive the following exception:</p>
  
  <pre><code>org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'group1.job1', because one already exists with this identification.
      at org.quartz.simpl.RAMJobStore.storeJob(RAMJobStore.java:279)
      at org.quartz.simpl.RAMJobStore.storeJobAndTrigger(RAMJobStore.java:251)
      at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:886)
      at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249)
      at com.stackoverflow.test.java.TestQuartz.main(TestQuartz.java:47)
  </code></pre>
  
  <p>Is it impossible to start one Job with several triggers? Can I somehow generate a schedule that considers more than one cron expression?</p>