堆栈如下
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactoryBean' defined in class path resource [cn/tongdun/fangsheng/schedule/config/ScheduleConfig.class]: Invocation of init method failed; nested exception is org.quartz.SchedulerException: JobStore class 'org.quartz.impl.jdbcjobstore.JobStoreTX' props could not be configured. [See nested exception: java.lang.NoSuchMethodException: No setter for property 'txIsolationLevelReadCommitted']
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657)
... 48 common frames omitted
Caused by: org.quartz.SchedulerException: JobStore class 'org.quartz.impl.jdbcjobstore.JobStoreTX' props could not be configured.
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:892)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1579)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:679)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.prepareScheduler(SchedulerFactoryBean.java:616)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
... 58 common frames omitted
Caused by: java.lang.NoSuchMethodException: No setter for property 'txIsolationLevelReadCommitted'
at org.quartz.impl.StdSchedulerFactory.setBeanProps(StdSchedulerFactory.java:1467)
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:890)
... 64 common frames omitted
主要原因:JobStore class 'org.quartz.impl.jdbcjobstore.JobStoreTX' props could not be configured
找到scheduler.properties
下的 org.quartz.jobStore.class 配置项,更改为如下参数
# use the `springframework` LocalDataSourceJobStore instead of quartz JobStoreTX while SpringBoot version over 2.5.6
# org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.class = org.springframework.scheduling.quartz.LocalDataSourceJobStore
这是由于springboot版本升级导致的问题,在2.5.6以后的版本使用 org.springframework.scheduling.quartz.LocalDataSourceJobStore