如何解决操作:更正应用程序的类路径,使其包含一个兼容的 org.apache.catalina.Context 版本
您好,我正在开发 spring boot,想将 tomcat 版本从 9 升级到 10,为此我已经对 pom.xml 文件进行了以下更改。应用程序在嵌入式 tomcat 版本中运行良好,但当我进行以下更改时,应用程序无法启动。
Q_INVOKABLE
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- <version>2.3.1.RELEASE</version> -->
<version>2.3.3.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>10.0.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>10.0.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
我的 pom.xml 文件包含以下依赖项。 :
***************************
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.boot.web.embedded.tomcat.TomcatServletWebServerFactory.configureContext(TomcatServletWebServerFactory.java:356)
The following method did not exist:
org.apache.catalina.Context.addServletContainerInitializer(Ljavax/servlet/ServletContainerInitializer;Ljava/util/Set;)V
The method's class,org.apache.catalina.Context,is available from the following locations:
jar:file:......../.m2/repository/org/apache/tomcat/tomcat-catalina/10.0.5/tomcat-catalina-10.0.5.jar!/org/apache/catalina/Context.class
The class hierarchy was loaded from the following locations:
org.apache.catalina.Context: file:....../.m2/repository/org/apache/tomcat/tomcat-catalina/10.0.5/tomcat-catalina-10.0.5.jar
Action:
Correct the classpath of your application so that it contains a single,compatible version of org.apache.catalina.Context
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。