java.lang.NoSuchMethodError: org.apache.tomcat.util.modeler.Registry.disableRegistry()V
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:192)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
at com.xuecheng.manage_cms_client.ManagerCmsClientApplication.main(ManagerCmsClientApplication.java:15)
2024-03-25 16:14:01.210 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter -
报错日志如上
SpringBoot的依赖版本是
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.8</version>
</parent>
主要原因是springboot依赖的tomcat版本是9.0.39
但是在依赖tomcat的时候错误的指定版本为
问题就出在tomcat版本和springboot的版本不匹配造成的,所以出现这种问题,需要检查tomcat版本,实在不想检查也可以直接在pom文件中添加
<dependency>-->
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>9.0.39</version>
<scope>compile</scope>
</dependencies>
进行强制依赖tomcat版本