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();
}
}
}
错误:
org.quartz.JobPersistenceException:无法获取下一个触发器:ERROR:“sched_time”列中的空值违反非空约束 详细信息:失败行包含(StepScheduler,NON_CLUSTERED1466000944643,dummyTriggerName,group1,NON_CLUSTERED,1466015299949,null,5,ACQUIRED,null,null,f,f)。 [请参阅嵌套异常:org.postgresql.util.PSQLException:ERROR:列“sched_time”中的空值违反非空约束 详细信息:失败行包含(DecisionIQStepScheduler,NON_CLUSTERED1466000944643,dummyTriggerName,group1,NON_CLUSTERED,1466015299949,null,5,ACQUIRED,null,null,f,f)。]
有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
这是由于quartz-scheduler.jar和SQL模式文件之间的版本不匹配。