【日期】: 2020/12/4
【问题】: 启动SpringBoot项目的时候,报错
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-04 17:16:22.709 ERROR 9924 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
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:/Ali-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:/Ali-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
【原因】: 因为引入了发邮件的依赖就出现这个错误。
<!--发邮件 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
【如何发现】: 由于是引入依赖才导致运行出问题的,然后一个个排查依赖,结果发现了这个依赖有冲突。
【如何修复】: 在上次引入JPA依赖启动报错的时候,就想研究明白,为什么引入这些依赖就会这个死循环错误。这次排查了一下依赖问题,原来是引入的依赖里有jar包冲突。
在引入的依赖里,排除有冲突的依赖即可。
<!-- 去除冲突的jar包 -->
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</exclusion>
</exclusions>
<!--发邮件 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<!-- 去除冲突的jar包 -->
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</exclusion>
</exclusions>
</dependency>
【总结】: 知识不够巩固,还是非常欠缺。
【BUG日记】【SpringBoot】启动SpringBoot项目的时候,报错 “The following method did not exist: org.quartz…” (一)