Skip to content

ch.qos.logback.access:tomcat has non-optional Tomcat dependencies #17

@jonatan-ivanov

Description

@jonatan-ivanov

I'm migrating from ch.qos.logback:logback-access to ch.qos.logback.access:tomcat.
Or from

ch.qos.logback:logback-access:1.4.14
ch.qos.logback:logback-core:1.5.6

to

ch.qos.logback.access:common:2.0.3
ch.qos.logback.access:tomcat:2.0.3
ch.qos.logback:logback-core:1.5.7

It seems that ch.qos.logback.access:tomcat:2.0.3 brings in Tomcat 10.0.x (tomcat-catalina and tomcat-coyote) as its compile time dependency so I end up with these on my classpath:

org.apache.tomcat:tomcat-api:10.0.27
org.apache.tomcat:tomcat-catalina:10.0.27
org.apache.tomcat:tomcat-coyote:10.0.27
org.apache.tomcat:tomcat-el-api:10.1.26
org.apache.tomcat:tomcat-jaspic-api:10.0.27
org.apache.tomcat:tomcat-jni:10.0.27
org.apache.tomcat:tomcat-jsp-api:10.1.26
org.apache.tomcat:tomcat-juli:10.0.27
org.apache.tomcat:tomcat-servlet-api:10.1.26
org.apache.tomcat:tomcat-util-scan:10.0.27
org.apache.tomcat:tomcat-util:10.0.27

The problem is that I'm using Tomcat 10.1.x instead with Spring Boot 3.3.x which not just brings in Tomcat 10.1.x but does not seem to be compatible with 10.0.x. Also, Tomcat was an optional dependency for ch.qos.logback:logback-access:1.4.14.

Excluding Tomcat from ch.qos.logback.access:tomcat seems to resolve the issue and this might be the case with jakarta.servlet too:

implementation('ch.qos.logback.access:tomcat:latest.release') {
    exclude group: 'org.apache.tomcat'
    exclude group: 'jakarta.servlet'
}

Let me leave here the whole error message in case someone gets the same:

2024-08-20T21:23:49.489Z  INFO 29479 --- [tea-service] [main] [                                                 ] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-08-20T21:23:49.505Z ERROR 29479 --- [tea-service] [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.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer.customizeMaxQueueCapacity(TomcatWebServerFactoryCustomizer.java:170)

The following method did not exist:

    'void org.apache.coyote.AbstractProtocol.setMaxQueueSize(int)'

The calling method's class, org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer, was loaded from the following location:

    jar:file:/Users/jivanov/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/3.3.2/6a9ab910b00f0b504a5903e3680ac10018da6247/spring-boot-autoconfigure-3.3.2.jar!/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.class

The called method's class, org.apache.coyote.AbstractProtocol, is available from the following locations:

    jar:file:/Users/jivanov/.gradle/caches/modules-2/files-2.1/org.apache.tomcat/tomcat-coyote/10.0.27/88364bdfcf72b38981f4c3617736d0a48881006f/tomcat-coyote-10.0.27.jar!/org/apache/coyote/AbstractProtocol.class
    jar:file:/Users/jivanov/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.26/5e0fa06ca373ef0ca55e603291ea51b590c377ea/tomcat-embed-core-10.1.26.jar!/org/apache/coyote/AbstractProtocol.class

The called method's class hierarchy was loaded from the following locations:

    org.apache.coyote.AbstractProtocol: file:/Users/jivanov/.gradle/caches/modules-2/files-2.1/org.apache.tomcat/tomcat-coyote/10.0.27/88364bdfcf72b38981f4c3617736d0a48881006f/tomcat-coyote-10.0.27.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.AbstractProtocol

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions