[英]java.lang.NoSuchMethodError:org.quartz.Scheduler.deleteTrigger(Ljava/lang/String;Ljava/lang/String;)V
Getting this error while trying to delete jon and trigger getting this error below is my code尝试删除 jon 并触发以下错误时出现此错误是我的代码
JobKey jobKey = JobKey.jobKey(jobName);
if (scheduler.checkExists(jobKey)) {
log.info("job found for "+ jobName);
boolean isdeletted = scheduler.deleteJob(new JobKey(jobName));
if (!isdeletted) {
log.error("job not deleted");
}
}
scheduler.unscheduleJob(new TriggerKey(triggerName));
please help me on this.请帮助我。 below is the starch trace
下面是淀粉痕迹
java.lang.NoSuchMethodError: framwork.deleteTrigger(Ljava/lang/String;Ljava/lang/String;)V
at framwork
at framwork
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at framwork
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy660.updatePartner(Unknown Source)
at framwork
at framwork
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at framwork
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
this stack trace of the error please help这个错误的堆栈跟踪请帮助
org.quartz.Scheduler#unscheduleJob
accepts the trigger key as parameter. org.quartz.Scheduler#unscheduleJob
接受触发键作为参数。 Hence, you can remove the trigger specified (which is bound to your job).因此,您可以删除指定的触发器(绑定到您的工作)。
public static boolean removeJob(String jobName, String jobGroup) throws SchedulerException {
TriggerKey triggerKey = TriggerKey.triggerKey(jobName, jobGroup);
if (scheduler.checkExists(triggerKey)) {
scheduler.unscheduleJob(triggerKey); // trigger + job
}
logger.info(">>>>>>>>>>> removeJob success, triggerKey:{}", triggerKey);
return true;
}
Hope that helps.希望有帮助。
Useful link: https://www.baeldung.com/quartz有用链接: https://www.baeldung.com/quartz
UPDATE更新
Back to the exception you are getting, the root cause is that you most likely have compiled a class against a different version of the class that is missing a method, than the one you are using when running it.回到您遇到的异常,根本原因是您很可能已经针对缺少方法的 class 的不同版本编译了 class,而不是您在运行它时使用的方法。
Make sure you don't have several versions of Quartz
in your classpath.确保你的类路径中没有多个版本的
Quartz
。 Try to clean you project et rebuild it if you are using Maven or Gradle.如果您使用 Maven 或 Gradle,请尝试清理您的项目并重建它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.