问题描述
在 Quartz 调度器中第一次执行第一个作业时,Spring 抛出了以下异常.请注意,作业在其执行过程中显式调用 applicationContext.getBean(...)
.
During the first execution of the first job in Quartz scheduler, the following exception is thrown by Spring. Note that the job makes an explicit call to applicationContext.getBean(...)
in its execution.
有人能解释这个异常的原因吗,也许还有避免它的方法?
Can someone explain the cause of this exception, and, maybe, the way to avoid it ?
Spring 版本:4.1.5.RELEASE石英版本:2.1.6
Spring version : 4.1.5.RELEASEQuartz version : 2.1.6
提前致谢
2015-07-24 09:20:27,416 ERROR be.citobi.mediquality.schedulers.A4MCubeJob - a4MCubeJob in error
java.lang.IllegalStateException: About-to-be-created singleton instance implicitly appeared through the creation of the factory bean that its bean definition points to
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:374)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:860)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:790)
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:542)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:436)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:412)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:337)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968)
at be.citobi.mediquality.schedulers.A4MCubeJob.execute(A4MCubeJob.java:26)
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
推荐答案
我发现了问题所在,在 Spring 配置中,几个实现 FactoryBean 的 bean 被声明为没有使用泛型.添加泛型解决了这个问题.
I find out what the problem was, in Spring config, several beans implementing FactoryBean were declared without using generics. Adding the generics solved the issue.
这很可能与 Quartz 无关.
This was most likely non related to Quartz.
这篇关于在第一次 Quartz 作业执行期间 Spring 抛出的 IllegalStateException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!