NutzCN Logo
问答 springboot集成nutz-integration-quartz,版本:1.r.68.v20190220
发布于 2046天前 作者 wx_3un8gefq8c8pul4do54f 1725 次浏览 复制 上一个帖子 下一个帖子
标签:

服务启动成功任务也已经添加,为啥在执行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());
    }
}
3 回复

走错片场了?springboot用nutz的quartz插件?

就是在我们现在的项目中想使用nutz-integration-quartz这个插件,是否可行?

从代码实现上说是可以,那就新建nutz ioc的时候,ioc loader得配置一下扫描注解的package

添加回复
请先登陆
回到顶部