NutzCN Logo
问答 Quartz启动报错-任务没有执行-求解答
发布于 227天前 作者 lampardlee 160 次浏览 复制 上一个帖子 下一个帖子
标签: quartz

cron.properties:

clean non-active user

cron.net.wendal.nutzbook.quartz.job.CleanNonActiveUserJob=0/1 * * * * ?

cron.pkgs=net.wendal.nutzbook.quartz.job

MainModule
@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/",
"*anno", "net.wendal.nutzbook",
"*tx",
"*org.nutz.integration.quartz.QuartzIocLoader"})
@Modules(scanPackage=true)
@ChainBy(args="mvc/nutzbook-mvc-chain.js")
public class MainModule {

}

CleanNonActiveUserJob:
package net.wendal.nutzbook.quartz.job;
@IocBean
public abstract class CleanNonActiveUserJob implements Job {

private static final Log log = Logs.get();

@Inject protected Dao dao;

//public void execute(JobExecutionContext context) throws JobExecutionException {
public void execute(JobExecutionContext context) throws JobExecutionException {
    log.debug("clean Non-Active User , start");
    log.debug("clean Non-Active User , Done");
}

}

2017-01-08 15:53:51,525 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'emailAuthenticator' to [app] 
2017-01-08 15:53:51,525 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-01-08 15:53:51,525 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-01-08 15:53:51,525 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-01-08 15:53:51,525 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-01-08 15:53:51,525 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-01-08 15:53:51,526 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-01-08 15:53:51,528 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'conf'<>
2017-01-08 15:53:51,528 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=cleanNonActiveUserJob
2017-01-08 15:53:51,529 org.nutz.integration.quartz.NutQuartzJobFactory.newJob(NutQuartzJobFactory.java:30) WARN  - Not ioc bean? fallback to SimpleJobFactory
org.nutz.ioc.IocException: [cleanNonActiveUserJob] # For object [cleanNonActiveUserJob] - type:[class net.wendal.nutzbook.quartz.job.CleanNonActiveUserJob]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:218)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:146)
	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 'cleanNonActiveUserJob' without define!
	at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:174)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:180)
	... 5 more
2017-01-08 15:53:51,531 org.quartz.simpl.SimpleJobFactory.newJob(SimpleJobFactory.java:51) DEBUG - Producing instance of Job 'DEFAULT.net.wendal.nutzbook.quartz.job.CleanNonActiveUserJob', class=net.wendal.nutzbook.quartz.job.CleanNonActiveUserJob
2017-01-08 15:53:51,532 org.quartz.core.ErrorLogger.schedulerError(QuartzScheduler.java:2425) ERROR - An error occured instantiating job to be executed. job= 'DEFAULT.net.wendal.nutzbook.quartz.job.CleanNonActiveUserJob'
org.quartz.SchedulerException: Problem instantiating class 'net.wendal.nutzbook.quartz.job.CleanNonActiveUserJob' [See nested exception: java.lang.InstantiationException]
	at org.quartz.simpl.SimpleJobFactory.newJob(SimpleJobFactory.java:58)
	at org.nutz.integration.quartz.NutQuartzJobFactory.newJob(NutQuartzJobFactory.java:31)
	at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127)
	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:375)
Caused by: java.lang.InstantiationException
	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at org.quartz.simpl.SimpleJobFactory.newJob(SimpleJobFactory.java:56)
	... 3 more
2017-01-08 15:53:51,532 org.quartz.simpl.RAMJobStore.triggeredJobComplete(RAMJobStore.java:1615) INFO  - All triggers of Job DEFAULT.net.wendal.nutzbook.quartz.job.CleanNonActiveUserJob set to ERROR state.
2017-01-08 15:53:51,532 org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:276) DEBUG - batch acquisition of 0 triggers
2017-01-08 15:53:52,208 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:141) INFO  - Nutz.Mvc[nutz] is up in 1478ms
一月 08, 2017 3:53:52 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [http-nio-9080]
一月 08, 2017 3:53:52 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler [ajp-nio-9009]
一月 08, 2017 3:53:52 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 3426 ms
2 回复

怎么是抽象类?去掉abstract

public class CleanNonActiveUserJob

多谢,疏忽了,去掉就可以正常运行了。

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