본문 바로가기

개발관련/error

[error sts] Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer and org.apache.coyote.http11.AbstractHttp11Protocol

728x90

Problem 

 

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:265)

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:/C:/Users/Josiah/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/3.1.5/spring-boot-autoconfigure-3.1.5.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:/C:/Tools/apache-tomcat-9.0.60/lib/tomcat-coyote.jar!/org/apache/coyote/http11/AbstractHttp11Protocol.class
    jar:file:/C:/Users/Josiah/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/10.1.15/tomcat-embed-core-10.1.15.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:/C:/Tools/apache-tomcat-9.0.60/lib/tomcat-coyote.jar
    org.apache.coyote.AbstractProtocol: file:/C:/Tools/apache-tomcat-9.0.60/lib/tomcat-coyote.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer and org.apache.coyote.http11.AbstractHttp11Protocol

 

cause

 

As the error message explains, you have two versions of the spring-boot-actuator-autoconfigure JAR on your classpath. You should only have one and it should be the version that is consistent and compatible with the other versions of dependencies in your application. This is not a Micrometer issue.

 

두 버전의 JAR 파일이 있어서 충돌

 

resolving the problem

프로젝트 우클릭 > build path > Libraries > Modulepath 에서 강제로 add 한  tomcat 삭제