I am having trouble successfully scheduling a job without getting the error mentioned in the header, in particular: The job (CRAWLS.my_repos) referenced by the trigger does not exist. [See nested exception: org.quartz.JobPersistenceException: The job (CRAWLS.my_repos) referenced by the trigger does not exist.]
Here's a look at the code ... from which everything seems to be in order.
The runJob method ... the main thing to note is that it does not work on this line: m_scheduler.scheduleJob(trigger);The rest of the method exists if the rest is useful.
public void runJob(JobInfo jobInfo,
com.lawson.search.spi.common.Properties jobProperties)
{
try {
JobDataMap jobDataMap = QuartzUtils.createJobDataMapFromLesProperties(jobProperties);
if (jobExists(jobInfo)) {
m_scheduler.triggerJob(jobKey(jobInfo.getName(), jobInfo.getGroup()), jobDataMap);
} else {
JobDetail job = QuartzUtils.createJobDetailFromJobInfo(jobInfo);
Trigger trigger = newTrigger()
.forJob(job)
.withIdentity(getImmediateTriggerName(jobInfo))
.build();
m_scheduler.scheduleJob(trigger);
}
} catch (SchedulerException e) {
String msg = "runJob: " + jobInfo;
if (s_log.isDebugEnabled()) {
s_log.debug(msg, e);
}
throw new JobSchedulerException(msg, e);
}
}
The method createJobDetailFromJobInfo()is simple but important:
static JobDetail createJobDetailFromJobInfo(JobInfo theJobInfo)
{
JobDetail detail = newJob(QuartzJobAdapter.class)
.withIdentity(theJobInfo.getName(), theJobInfo.getGroup())
.storeDurably()
.build();
return detail;
}
The only important method that I can think of is a method getImmediateTriggerName()that I think can cause a problem ... but I don't know why.
private String getImmediateTriggerName(JobInfo jobInfo)
{
return jobInfo.getName() + "#" + jobInfo.getGroup() + ":" + System.currentTimeMillis();
}
Any help would be appreciated.
source
share