I am trying to run a scheduler which will update dates in my database table. The cron is starting but it is not starting the job!
My cron file -->
package Crons.Schedulers;
import org.quartz.CronTrigger;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.JobDetail;
public class WeeklySchedule{
public WeeklySchedule()throws Exception {
SchedulerFactory sf=new StdSchedulerFactory();
Scheduler sched=sf.getScheduler();
sched.start();
JobDetail jd=new JobDetail("WeeklyTask","Weekly",Week开发者_开发技巧lyJob.class);
CronTrigger ct=new CronTrigger("cronTrigger","group2","0 57 16 * * ?");
sched.scheduleJob(jd,ct);
}
public static void main(String args[]){
try{
new WeeklySchedule();
}catch(Exception e){}
}
}
The output shown is -->
INFO SimpleThreadPool(initialize:247) - Job execution threads will use class loader of thread: main
INFO QuartzScheduler(<init>:195) - Quartz Scheduler v.1.5.2 created.
INFO RAMJobStore(initialize:138) - RAMJobStore initialized.
INFO StdSchedulerFactory(instantiate:1014) - Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
INFO StdSchedulerFactory(instantiate:1018) - Quartz scheduler version: 1.5.2
INFO QuartzScheduler(start:400) - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
I have no idea what is going wrong as I am using quartz for the first time. What can be the possible reason?
Thanks in advance.
this line
CronTrigger ct=new CronTrigger("cronTrigger","group2","0 57 16 * * ?");
says your job'll start at 16:57. see this Quartz CronTrigger Tutorial
精彩评论