【日期】: 2020/11/17
【问题】: 启动SpringBoot项目的时候,报错
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.scheduling.quartz.SchedulerAccessor.registerListeners(SchedulerAccessor.java:351)
The following method did not exist:
org.quartz.Scheduler.getListenerManager()Lorg/quartz/ListenerManager;
The method's class, org.quartz.Scheduler, is available from the following locations:
jar:file:/D:/Maven-Repository/org/opensymphony/quartz/quartz/1.6.1/quartz-1.6.1.jar!/org/quartz/Scheduler.class
It was loaded from the following location:
file:/D:/Maven-Repository/org/opensymphony/quartz/quartz/1.6.1/quartz-1.6.1.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.quartz.Scheduler
【原因】: 因为引入了JPA依赖就出现这个错误。
<!--↓↓↓JPA依赖↓↓↓ -->
// 使用的是JpaTransactionManager
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
【如何发现】: 由于是引入依赖才导致运行出问题的,然后一个个排查依赖,结果发现了这个依赖有冲突。
【如何修复】: 在这个依赖注释掉,或者找到对应Maven库里把org/opensymphony/删掉,但是并没有解决根源问题,还是有点疑惑,为什么引入这个依赖就会报错。
【总结】: 知识不够巩固,还是非常欠缺。