org.nutz.ioc.IocException: IocBean[quartzStarter] throw Exception when creating
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161)
at org.nutz.boot.NbApp.prepareStarterInstance(NbApp.java:455)
at org.nutz.boot.NbApp.prepare(NbApp.java:289)
at org.nutz.boot.NbApp.execute(NbApp.java:195)
at org.nutz.boot.NbApp.run(NbApp.java:177)
at io.nutz.demo.MainLauncher.main(MainLauncher.java:51)
Caused by: java.lang.RuntimeException: IocBean[quartzStarter] fail at field=[scheduler]
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
... 8 more
Caused by: org.nutz.ioc.IocException: IocBean[scheduler] throw Exception when creating
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
... 10 more
Caused by: org.nutz.lang.born.BorningException: Fail to born or cast to 'org.quartz.impl.StdSchedulerFactory'
by args: []
because:org.quartz.SchedulerConfigException: Thread count must be > 0
at org.nutz.lang.born.MethodBorning.born(MethodBorning.java:20)
at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:78)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:117)
... 13 more
Caused by: org.quartz.SchedulerConfigException: Thread count must be > 0
at org.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1311)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1559)
at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1575)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.nutz.lang.born.MethodBorning.born(MethodBorning.java:17)
... 15 more
quartz.properties 文件内容:
quartz.scheduler.instanceName=AddJob
quartz.threadPool.threadCount=4
package io.nutz.demo.job;
import io.nutz.demo.bean.Permission;
import org.nutz.dao.Dao;
import org.nutz.integration.quartz.annotation.Scheduled;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
/**
* Created by Administrator on 2018/6/12.
*/
@Scheduled(cron="*/5 * * * * ?")
@IocBean
public class AddJob implements Job {
@Inject
private Dao dao;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
Permission user=new Permission();
user.setName("root");
dao.insert(user);
}
}