我正在使用Grails 3.3.11
和Quartz Grails插件2.0.13构建一个应用程序,有一些旧作业我将它们迁移到我的新应用程序,它们以前工作正常,但是现在我在尝试从Quartz监视器
页面手动运行它们时收到以下错误,在创建新作业并尝试手动运行它后也会收到相同的错误。知道可能导致此错误的原因以及如何解决它吗?
2020-09-07 17:12:29.308 ERROR --- [SchedulerThread] org.quartz.core.ErrorLogger : An error occured instantiating job to be executed. job= 'GRAILS_JOBS.utradeorders.EveryEndOfDayJob'
org.quartz.SchedulerException: Job instantiation failed
at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:45)
at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:375)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'utradeorders.EveryEndOfDayJob': Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.Object]: Factory method 'newInstance' threw exception; nested exception is org.grails.core.exceptions.NewInstanceCreationException: Could not create a new instance of class [utradeorders.EveryEndOfDayJob]!
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.b
eans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1177)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:331)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1082)
at grails.plugins.quartz.GrailsJobFactory.createJobInstance(GrailsJobFactory.java:48)
at grails.plugins.quartz.QuartzMonitorJobFactory.super$3$createJobInstance(QuartzMonitorJobFactory.groovy)
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.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1433)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:145)
at grails.plugins.quartz.QuartzMonitorJobFactory.createJobInstance(QuartzMonitorJobFactory.groovy:24)
at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:41)
... 2 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.Object]: Factory method 'newInstance' threw exception; nested exception is org.grails.core.exceptions.NewInstanceCreationException: Could not create a new instance of class [utradeorders.EveryEndOfDayJob]!
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 22 common frames omitted
Caused by: org.grails.core.exceptions.NewInstanceCreationException: Could not create a new instance of class [utradeorders.EveryEndOfDayJob]!
at org.grails.core.AbstractGrailsClass.newInstance(AbstractGrailsClass.java:128)
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.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1433)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 23 common frames omitted
Caused by: groovy.lang.MissingMethodException: No signature of method: static grails.web.api.WebAttributes.$init$() is applicable for argument types: (utradeorders.EveryEndOfDayJob) values: [utradeorders.EveryEndOfDayJob@27cf1bcc]
Possible solutions: wait(), find(), print(java.lang.Object), print(java.io.PrintWriter), println(), wait(long)
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1518)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1504)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:921)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:181)
at grails.web.api.WebAttributes$Trait$Helper.$static_methodMissing(WebAttributes.groovy)
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.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1433)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1516)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1504)
at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at utradeorders.EveryEndOfDayJob.<init>(EveryEndOfDayJob.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1076)
at org.grails.core.AbstractGrailsClass.newInstance(AbstractGrailsClass.java:118)
... 29 common frames omitted
以下是我的工作示例:
class EveryEndOfDayJob {
//def utilsService
static triggers = {
cron name: "daily", cronExpression: "0 0 1 * * ?"
}
def execute() {
println("Job is running")
}
}
当我审查build.gradle
时,我发现它是编写的compile'org.grails.plugins: stone: 2.0.13'
我将其更改为runtime
,一切都按预期工作。
下载Grails 3.3.13并创建全新项目后,您可以添加插件石英2.0.13,一切按预期工作:https://github.com/majkelo/stackoverflow-quartz-issue
如果我是你,我会关注例外:
原因:org.springframework.beans.factory.BeanCreationException:创建名为“utradeorder”的bean时出错。AllEndOfDayJobs':通过工厂方法进行Bean实例化失败;嵌套异常org.springframework.beans.BeanInstantiationException:实例化[java.lang.对象]失败:工厂方法“newInstance”抛出异常;嵌套异常org.grails.core.exceptions.NewInstanceCreationException:无法创建类的新实例[utradeorder. AllEndOfDayJobs]!
特别是检查:创建名为“utradeorders”的bean时出错。EveryEndOfDayJob'
您是否将此作业放在正确的位置/子文件夹中?如果将其移出utradeorder
子文件夹会发生什么?
我有问题运行的小球与OWL-API。要调试代码,将引发以下异常: 在下一行抛出异常: OWLReasoner reasoner=ReasonerFactory.CreateReasoner(本体,新的SimpleConfiguration()); pom.xml: System.out.println(System.GetProperty(“java.class.path”))的结果;
我想把它集成到libgdx中。Liquidfun看起来不错,但我听说它给可移植性带来了问题,而且不能很好地与桌面应用程序配合使用。根据我的理解,libgdx中的粒子效应并不遵循粒子所涉及的物理,所以我认为我也不应该走那条路。
我很难让Grails中的Quartz工作按预期同时运行。这就是我的工作。我已经注释掉了使用Executor插件的代码行,但是当我没有注释掉它们时,我的代码会按预期工作。 就我而言,myService2。doOtherStuff()需要很长时间才能完成,这与下一次触发此作业的时间重叠。我不介意它们是否重叠,这就是我明确添加def concurrent=true的原因,但它不起作用。 我有Quartz
问题内容: 似乎Quartz Scheduler每秒可以运行的作业数量受到限制。在我们的方案中,我们每秒大约有20个作业,可以进行24x7的启动,而石英可以很好地完成每秒10个作业(对于JDBC支持的JobStore,它具有100个石英线程和100个数据库连接池大小),但是,当我们将其增加到20个时每秒的作业数量,石英变得非常非常慢,与实际的计划时间相比,石英的触发作业非常晚,从而导致许多失火,并
我正在使用带有TerracottaJobStore Class的石英调度程序来每5分钟调度一次作业。我的工作配置是: 组织。石英jobStore。class=org。陶土。石英EnterpriseTerracottaJobStore组织。石英jobStore。tcconfig=localhost:9510 org。石英线程池。线程数=25 我有一个附加了5000个触发器的单个作业,然后该作业被安排
问题内容: 有没有办法将石英作为基础调度程序? 我可以想到两件事,但都需要做一些工作: 创建一个将解析注解并注册石英作业的自定义 实施委托石英的工具。 问题是:以上两个选项是否已经编写过,是否还有另一个选项? 问题答案: 我最终制作了自己的弹簧石英“桥”。我打算建议将其作为春季的改进。 首先,我创建了一个新注释,该注释将放置在实现quartz Job接口的类上: (请注意原型作用域-石英假定每个作