quartz执行出错

最近在做微信同步接口,用的quartz做的定时任务,同步的时候总是报下面一个错误。

错误代码

[ERROR][2017/06/13?09:49:00242][org.quartz.core.JobRunShell.run(JobRunShell.java:211)]
Job DEFAULT.wxMediaTokenJobDetail threw an unhandled Exception: 
java.lang.NoSuchMethodError: org.quartz.JobExecutionException.<init>(Ljava/lang/String;Ljava/lang/Exception;Z)V
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:174)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
[DEBUG][2017/06/13?09:49:00246][org.quartz.utils.ExceptionHelper.supportsNestedThrowable(ExceptionHelper.java:97)]
Detected JDK support for nested exceptions.

NoSuchMethodError,感觉非常奇怪,配置文件里面的执行方法名并没有错误。更奇怪的是,有的任务能够执行成功,有的却报上面的错误了。

经过分析,应该是execute方法 里面报错了而没有捕捉,导致一层层向上抛出了异常。

为了验证猜想,重新建一个测试方法,

 public void syncMedia() {
        int zero = 0;
        int test = 123 / zero;
        System.out.println(test);
    }

运行后,果然报了和上面一样的错。

检查execute里面的方法,发现查询语句有些问题,导致异常。。。

Over…

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值