pom.xml
com.jfinaljfinal2.2
cn.dreampiejfinal-quartz0.2
配置文件:
QuartzPlugin quartz = QuartzPlugin()plugins.add(quartz)
具体的任务类:
org.quartz.Joborg.quartz.JobExecutionContextorg.quartz.JobExecutionExceptionSynchronizeJob Job { (JobExecutionContext context) JobExecutionException { System..println(){ Thread.()} (InterruptedException e) { e.printStackTrace()} System..println()} }
启动时加载任务类:
new QuartzCronJob(new QuartzKey(5, "同步数据", "default"), "* */1 * * * ?", SynchronizeJob.class).start();
框架启动使用tomcat 7.0.70启动, 报如下错误 :
2019-01-15 17:28:32
[ERROR]-[Thread: RMI TCP Connection(3)-127.0.0.1]-[com.jfinal.core.Config.startPlugins()]: Plugin start error: cn.dreampie.quartz.QuartzPlugin.
Can't start quartz plugin.
java.lang.RuntimeException: Can't start quartz plugin.
at cn.dreampie.quartz.QuartzPlugin.start(QuartzPlugin.java:54)
at com.jfinal.core.Config.startPlugins(Config.java:88)
at com.jfinal.core.Config.configJFinal(Config.java:49)
at com.jfinal.core.JFinal.init(JFinal.java:62)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at ......
Caused by: java.lang.IllegalArgumentException: Properties file not found: D:\workspace\jfinal-share\out\artifacts\share\WEB-INF\classes\/quartz/quartz.properties
at cn.dreampie.PropertiesKit.loadPropertyFile(PropertiesKit.java:54)
at cn.dreampie.quartz.QuartzPlugin.start(QuartzPlugin.java:43)
... 52 more
非常疑惑, 因为我同事在他的电脑上用同样的代码, 可以正常启动, 我却不行, 他也没有quartz.properties, 开发工具: IDEA, Eclipse都使用了, 一样的效果, 恳请大神解惑....