Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jonatan-ivanov opened this issue Aug 20, 2024 · 1 comment
Open

Comments

@jonatan-ivanov
Copy link

jonatan-ivanov commented Aug 20, 2024

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
jonatan-ivanov added a commit to jonatan-ivanov/teahouse that referenced this issue Aug 20, 2024
@jonatan-ivanov
Copy link
Author

Also, it seems 10.0 reached EOL and not supported anymore:

Please note that Tomcat 10.0.x has reached end of life and is no longer supported. Vulnerabilities reported after 31 October 2022 were not checked against the 10.0.x branch and will not be fixed. Users should upgrade to 10.1.x or later to obtain security fixes.

https://tomcat.apache.org/security-10.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant