服务启动成功任务也已经添加,为啥在执行testjob定时任务处理类的时候报错
2019-05-17 16:58:20.120 [DefaultQuartzScheduler_Worker-4] ERROR com.qkwl.service.setquratz.quartz.TestJob - Hello Job鎵ц鏃堕棿: Fri May 17 16:58:20 CST 2019
2019-05-17 16:58:30.210 [DefaultQuartzScheduler_QuartzSchedulerThread] WARN org.nutz.integration.quartz.NutQuartzJobFactory - Not ioc bean? fallback to SimpleJobFactory
org.nutz.ioc.IocException: IocBean[testJob] For object [testJob] - type:[class com.qkwl.service.setquratz.quartz.TestJob]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:250)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161)
at org.nutz.integration.quartz.NutQuartzJobFactory.newJob(NutQuartzJobFactory.java:27)
at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:375)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'testJob' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:157)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:195)
... 5 common frames omitted
具体类的实现:
@DisallowConcurrentExecution
@IocBean
public class TestJob implements Job {
private static Logger _log = LoggerFactory.getLogger(TestJob.class);
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
JobDataMap map = jobExecutionContext.getJobDetail().getJobDataMap();
String taskId = jobExecutionContext.getJobDetail().getKey().getName();
_log.error("Hello Job-------------------------: " + new Date());
}
}