title: How to migrate from RAMJobStore to JobStoreCMT for persisted Quartz jobs in Seam
body: <p>I am trying to get a simple example of the Quartz scheduler working in JBoss Seam 2.2.0.GA. Everything works fine using the RAMJobStore setting, but changing the store from</p>
  
  <pre><code>org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
  </code></pre>
  
  <p>to </p>
  
  <pre><code>org.quartz.jobStore.class org.quartz.impl.jdbcjobstore.JobStoreCMT
  org.quartz.jobStore.driverDelegateClass org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
  org.quartz.jobStore.useProperties false
  org.quartz.jobStore.dataSource quartzDatasource
  ## FIXME Should be a different datasource for the non managed connection.
  org.quartz.jobStore.nonManagedTXDataSource quartzDatasource
  org.quartz.jobStore.tablePrefix qrtz_
  org.quartz.dataSource.quartzDatasource.jndiURL java:/quartzDatasource
  </code></pre>
  
  <p>allows the scheduler to start up, but whereas the job was previously being triggered and run at the correct interval, now it is not run at all. There is also nothing persisted to the quartz database.</p>
  
  <p>I am aware that the nonManagedTXDataSource shouldn't be the same as the managed datasource, but I am having issues with the datasource being unable to be found by Quartz, even though there is a message earlier on reporting it being bound successfully (this is probably about to be asked in a separate question). Using the same datasource allows the service to start up without errors.</p>
  
  <p>My components.xml file has the following:</p>
  
  <pre><code>&lt;event type="org.jboss.seam.postInitialization"&gt; 
     &lt;action execute="#{asyncResultMapper.scheduleTimer}"/&gt; 
  &lt;/event&gt;
  &lt;async:quartz-dispatcher/&gt;
  </code></pre>
  
  <p>and ASyncResultMapper has the following:</p>
  
  <pre><code>@In
  ScheduleProcessor processor;
  private String text = "ahoy";
  private QuartzTriggerHandle quartzTriggerHandle;
  
  public void scheduleTimer() {
      String cronString = "* * * * * ?";
      quartzTriggerHandle = processor.createQuartzTimer(new Date(), cronString, text);
  }
  </code></pre>
  
  <p>and ScheduleProcessor is as follows:</p>
  
  <pre><code>@Name("processor")
  @AutoCreate
  @Startup
  @Scope(ScopeType.APPLICATION)
  public class ScheduleProcessor { 
  
      @Asynchronous
      public QuartzTriggerHandle createQuartzTimer(@Expiration Date when, @IntervalCron String interval, String text) {
          process(when, interval, text);
          return null;
      }
  
      private void process(Date when, String interval, String text) {
          System.out.println("when = " + when);
          System.out.println("interval = " + interval);
          System.out.println("text = " + text);
      }
  }
  </code></pre>
  
  <p>The logs show the service starting but nothing about the job:</p>
  
  <pre><code>INFO  [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
  INFO  [JobStoreCMT] Using db table-based data access locking (synchronization).
  INFO  [JobStoreCMT] Removed 0 Volatile Trigger(s).
  INFO  [JobStoreCMT] Removed 0 Volatile Job(s).
  INFO  [JobStoreCMT] JobStoreCMT initialized.
  INFO  [JobStoreCMT] Freed 0 triggers from 'acquired' / 'blocked' state.
  INFO  [JobStoreCMT] Recovering 0 jobs that were in-progress at the time of the last shut-down.
  INFO  [JobStoreCMT] Recovery complete.
  INFO  [JobStoreCMT] Removed 0 'complete' triggers.
  INFO  [JobStoreCMT] Removed 0 stale fired job entries.
  INFO  [QuartzScheduler] Scheduler FlibScheduler$_NON_CLUSTERED started.
  </code></pre>
  
  <p>I'm sure it's probably something trivial I've missed, but I can't find a solution in the forums anywhere.</p>