I have included tomcat in my pom
<dependencies>
...
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>8.5.32</version>
</dependency>
</dependencies>
and when I run the spring boot application, I get the following message:
*************************** 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.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer.customizeMaxHttpRequestHeaderSize(TomcatWebServerFactoryCustomizer.java:264)
The following method did not exist:
'void org.apache.coyote.http11.AbstractHttp11Protocol.setMaxHttpRequestHeaderSize(int)'
The calling method's class, org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer, was loaded from the following location:
jar:file:/home/kamil/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/3.1.0/spring-boot-autoconfigure-3.1.0.jar!/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.class
The called method's class, org.apache.coyote.http11.AbstractHttp11Protocol, is available from the following locations:
jar:file:/home/kamil/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.32/tomcat-embed-core-8.5.32.jar!/org/apache/coyote/http11/AbstractHttp11Protocol.class
The called method's class hierarchy was loaded from the following locations:
org.apache.coyote.http11.AbstractHttp11Protocol: file:/home/user/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.32/tomcat-embed-core-8.5.32.jar org.apache.coyote.AbstractProtocol: file:/home/user/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.32/tomcat-embed-core-8.5.32.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes
org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer
andorg.apache.coyote.http11.AbstractHttp11Protocol
and when I remove it, the compiler doesn't see javax.servlet.http.HttpServletRequest
, javax.servlet.http.HttpServletResponse
, and javax.servlet.http.FilterChain
.
Remove the tomcat dependency. Spring Boot BOM is going to provide it for you. Change javax
to jakarta
as they were replaced in Spring Security 6.