Reputation: 2115
import static org.quartz.JobBuilder.newJob;
import org.quartz.CronScheduleBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;
import static org.quartz.SimpleScheduleBuilder.*;
public class QuartzTest {
public static void main(String[] args) {
try {
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
JobDetail jobDetail = newJob(HelloJob.class).withIdentity("Hello Job").build();
Trigger trigger = TriggerBuilder
.newTrigger()
.withIdentity("dummyTriggerName", "group1")
.withSchedule(
/*CronScheduleBuilder.cronSchedule("0/5 * * * * ?")*/
simpleSchedule().
withIntervalInSeconds(15).
repeatForever()
)
.build();
// and start it off
scheduler.start();
scheduler.scheduleJob(jobDetail, trigger);
// scheduler.shutdown();
} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Error:
org.quartz.JobPersistenceException: Couldn't acquire next trigger: ERROR: null value in column "sched_time" violates not-null constraint Detail: Failing row contains (StepScheduler, NON_CLUSTERED1466000944643, dummyTriggerName, group1, NON_CLUSTERED, 1466015299949, null, 5, ACQUIRED, null, null, f, f). [See nested exception: org.postgresql.util.PSQLException: ERROR: null value in column "sched_time" violates not-null constraint Detail: Failing row contains (DecisionIQStepScheduler, NON_CLUSTERED1466000944643, dummyTriggerName, group1, NON_CLUSTERED, 1466015299949, null, 5, ACQUIRED, null, null, f, f).]
Can some one help me to fix this issue?
Upvotes: 1
Views: 2060
Reputation: 2115
It was due to a version mismatch between quartz-scheduler.jar and SQL schema file.
Upvotes: 0