spring boot整合quartz报错:Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/reflect/Constructor;

今天在做spring boot与quartz整合的时候报错

org.quartz.SchedulerException: Job instantiation failed
	at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:47)
	at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127)
	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:392)
Caused by: java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.accessibleConstructor(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/reflect/Constructor;
	at org.springframework.scheduling.quartz.AdaptableJobFactory.createJobInstance(AdaptableJobFactory.java:61)
	at org.springframework.scheduling.quartz.SpringBeanJobFactory.createJobInstance(SpringBeanJobFactory.java:77)
	at com.ylkj.zhantai.ws12345.SpringJobFactory.createJobInstance(SpringJobFactory.java:29)
	at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:43)
	... 2 common frames omitted

原因不明,很困惑。后来看到一篇文章:

Spring报错java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.getMethod(Ljava/lang/Class

想了起来,由于spring boot整合quartz要加入两个依赖

	compile group: 'org.springframework', name: 'spring-context-support', version: '5.0.5.RELEASE'
	compile group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.0'

而这里没有考虑到spring framework的版本,而gradle的spring boot版本信息不太清晰


改为4.3.8就可以了

经验:以后看到这种Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/reflect/Constructor;类型的报错,显然要考虑依赖出错了

阅读更多
个人分类: spring boot
上一篇spring boot打包成jar并在windows或linux虚拟机上运行
下一篇web service的基础知识
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭