2

I'm migrating a project from Spring Boot 2.6.1 to Spring Boot 3.0.2 and I'm having problems with log4j dependencies versions. I have modified all the dependencies that were giving me problems but I still couldn't solve the problem. The error is as follows:

Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jar:file:/C:/Users/Pablo/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.18.0/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
ERROR [2023-01-27 11:54:41] [ org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter report 40]  

***************************
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.logging.log4j2.Log4J2LoggingSystem.initialize(Log4J2LoggingSystem.java:242)

The following method did not exist:

    'void org.apache.logging.log4j.util.PropertiesUtil.addPropertySource(org.apache.logging.log4j.util.PropertySource)'

The calling method's class, org.springframework.boot.logging.log4j2.Log4J2LoggingSystem, was loaded from the following location:

    jar:file:/C:/Users/Pablo/.m2/repository/org/springframework/boot/spring-boot/3.0.2/spring-boot-3.0.2.jar!/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.class

The called method's class, org.apache.logging.log4j.util.PropertiesUtil, is available from the following locations:

    jar:file:/C:/Users/Pablo/.m2/repository/org/apache/logging/log4j/log4j-api/2.18.0/log4j-api-2.18.0.jar!/org/apache/logging/log4j/util/PropertiesUtil.class

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

    org.apache.logging.log4j.util.PropertiesUtil: file:/C:/Users/Pablo/.m2/repository/org/apache/logging/log4j/log4j-api/2.18.0/log4j-api-2.18.0.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.logging.log4j2.Log4J2LoggingSystem and org.apache.logging.log4j.util.PropertiesUtil


Process finished with exit code 0

And the service dependencies are:

 --- maven-dependency-plugin:2.8:tree (default-cli) @ core ---
[INFO] es._3xs.adp:core:jar:1.0-SNAPSHOT                                                   
[INFO] +- es._3xs.adp:library:jar:1.0-SNAPSHOT:compile                                     
[INFO] |  +- org.springframework.boot:spring-boot-configuration-processor:jar:3.0.2:compile
[INFO] |  +- org.springframework:spring-websocket:jar:6.0.4:compile                        
[INFO] |  |  \- org.springframework:spring-context:jar:6.0.4:compile                       
[INFO] |  +- org.springframework.retry:spring-retry:jar:2.0.0:compile
[INFO] |  +- com.opencsv:opencsv:jar:5.5.2:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] |  |  +- org.apache.commons:commons-text:jar:1.9:compile
[INFO] |  |  +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |  |  |  +- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  |  |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  |  \- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] |  \- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO] |     \- commons-codec:commons-codec:jar:1.15:compile
[INFO] +- org.springframework.data:spring-data-redis:jar:3.0.1:compile
[INFO] |  +- org.springframework.data:spring-data-keyvalue:jar:3.0.1:compile
[INFO] |  |  \- org.springframework.data:spring-data-commons:jar:3.0.1:compile
[INFO] |  +- org.springframework:spring-tx:jar:6.0.4:compile
[INFO] |  +- org.springframework:spring-oxm:jar:6.0.4:compile
[INFO] |  +- org.springframework:spring-aop:jar:6.0.4:compile
[INFO] |  +- org.springframework:spring-context-support:jar:6.0.4:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:2.0.6:compile
[INFO] +- redis.clients:jedis:jar:3.7.0:compile
[INFO] |  \- org.apache.commons:commons-pool2:jar:2.11.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-websocket:jar:3.0.2:compile
[INFO] |  \- org.springframework:spring-messaging:jar:6.0.4:compile
[INFO] +- commons-io:commons-io:jar:2.6:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:3.0.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:3.0.2:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.33:compile
[INFO] |  \- org.eclipse.angus:jakarta.mail:jar:1.0.0:compile
[INFO] |     \- org.eclipse.angus:angus-activation:jar:1.0.0:runtime
[INFO] +- uk.org.webcompere:system-stubs-junit4:jar:1.2.0:test
[INFO] |  \- uk.org.webcompere:system-stubs-core:jar:1.2.0:test
[INFO] +- com.h2database:h2:jar:1.4.200:compile
[INFO] +- org.apache.httpcomponents.client5:httpclient5:jar:5.2.1:compile
[INFO] |  +- org.apache.httpcomponents.core5:httpcore5:jar:5.1.5:compile
[INFO] |  \- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.1.5:compile
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:3.0.2:compile
[INFO] |  \- org.thymeleaf:thymeleaf-spring6:jar:3.1.1.RELEASE:compile
[INFO] |     \- org.thymeleaf:thymeleaf:jar:3.1.1.RELEASE:compile
[INFO] |        +- org.attoparser:attoparser:jar:2.0.6.RELEASE:compile
[INFO] |        \- org.unbescape:unbescape:jar:1.1.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-rest:jar:3.0.2:compile
[INFO] |  \- org.springframework.data:spring-data-rest-webmvc:jar:4.0.1:compile
[INFO] |     \- org.springframework.data:spring-data-rest-core:jar:4.0.1:compile
[INFO] |        +- org.springframework.hateoas:spring-hateoas:jar:2.0.1:compile
[INFO] |        +- org.springframework.plugin:spring-plugin-core:jar:3.0.0:compile
[INFO] |        \- org.atteo:evo-inflector:jar:1.3:compile
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity5:jar:3.0.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:3.0.2:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:3.0.2:compile
[INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:3.0.2:compile
[INFO] +- org.springframework.ldap:spring-ldap-core:jar:2.3.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:6.0.4:compile
[INFO] |  \- org.springframework:spring-core:jar:6.0.4:compile
[INFO] |     \- org.springframework:spring-jcl:jar:6.0.4:compile
[INFO] +- com.github.wvengen:proguard-maven-plugin:jar:2.6.0:compile
[INFO] |  +- org.apache.ant:ant:jar:1.10.12:compile
[INFO] |  |  \- org.apache.ant:ant-launcher:jar:1.10.12:compile
[INFO] |  +- org.apache.maven:maven-archiver:jar:2.4:compile
[INFO] |  |  +- org.apache.maven:maven-artifact:jar:2.0:compile
[INFO] |  |  +- org.apache.maven:maven-model:jar:2.0:compile
[INFO] |  |  +- org.apache.maven:maven-project:jar:2.0:compile
[INFO] |  |  |  +- org.apache.maven:maven-profile:jar:2.0:compile
[INFO] |  |  |  +- org.apache.maven:maven-artifact-manager:jar:2.0:compile
[INFO] |  |  |  |  +- org.apache.maven:maven-repository-metadata:jar:2.0:compile
[INFO] |  |  |  |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-5:compile
[INFO] |  |  |  \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8:compile
[INFO] |  |  |     \- classworlds:classworlds:jar:1.1-alpha-2:compile
[INFO] |  |  +- org.codehaus.plexus:plexus-archiver:jar:1.0-alpha-11:compile
[INFO] |  |  |  +- org.codehaus.plexus:plexus-component-api:jar:1.0-alpha-15:compile
[INFO] |  |  |  \- org.codehaus.plexus:plexus-io:jar:1.0-alpha-3:compile
[INFO] |  |  +- org.codehaus.plexus:plexus-utils:jar:1.4.9:compile
[INFO] |  |  \- org.codehaus.plexus:plexus-interpolation:jar:1.6:compile
[INFO] |  \- org.apache.maven:maven-plugin-api:jar:3.8.6:compile
[INFO] |     +- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.3.5:compile
[INFO] |     |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |     |  +- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.3.5:compile
[INFO] |     |  \- org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile
[INFO] |     \- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.22:compile
[INFO] +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-oauth2:jar:2.2.5.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter-security:jar:2.2.5.RELEASE:compile
[INFO] |  |  \- org.springframework.cloud:spring-cloud-security:jar:2.2.5.RELEASE:compile
[INFO] |  |     \- org.springframework.boot:spring-boot-starter-security:jar:3.0.2:compile
[INFO] |  +- org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:jar:2.1.2.RELEASE:compile
[INFO] |  |  +- org.springframework.security.oauth:spring-security-oauth2:jar:2.3.4.RELEASE:compile
[INFO] |  |  |  +- org.springframework.security:spring-security-core:jar:6.0.1:compile
[INFO] |  |  |  +- org.springframework.security:spring-security-config:jar:6.0.1:compile
[INFO] |  |  |  +- org.springframework.security:spring-security-web:jar:6.0.1:compile
[INFO] |  |  |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |  |  |     \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] |  |  \- org.springframework.security:spring-security-jwt:jar:1.0.9.RELEASE:compile
[INFO] |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
[INFO] |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
[INFO] |  \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.2:compile
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.0:compile
[INFO] |  +- org.glassfish.jaxb:txw2:jar:4.0.1:compile
[INFO] |  +- com.sun.istack:istack-commons-runtime:jar:4.1.1:compile
[INFO] |  +- org.jvnet.staxex:stax-ex:jar:2.1.0:compile
[INFO] |  +- com.sun.xml.fastinfoset:FastInfoset:jar:2.1.0:compile
[INFO] |  \- jakarta.activation:jakarta.activation-api:jar:2.1.1:compile
[INFO] +- com.sun.xml.bind:jaxb-core:jar:3.0.2:compile
[INFO] |  \- com.sun.activation:jakarta.activation:jar:2.0.1:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.3.0:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.4.0-b180830.0359:compile
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.13.0:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.14.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.14.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.14.1:compile
[INFO] |  +- org.codehaus.woodstox:stax2-api:jar:4.2.1:compile
[INFO] |  \- com.fasterxml.woodstox:woodstox-core:jar:6.2.6:compile
[INFO] +- net.sourceforge.jtds:jtds:jar:1.3.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:3.0.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:3.0.2:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.19:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:3.0.2:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:5.0.1:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:6.0.4:compile
[INFO] |  +- org.hibernate.orm:hibernate-core:jar:6.1.6.Final:compile
[INFO] |  |  +- jakarta.persistence:jakarta.persistence-api:jar:3.1.0:compile
[INFO] |  |  +- jakarta.transaction:jakarta.transaction-api:jar:2.0.1:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.5.0.Final:runtime
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:6.0.2.Final:runtime
[INFO] |  |  +- org.jboss:jandex:jar:2.4.2.Final:runtime
[INFO] |  |  +- com.fasterxml:classmate:jar:1.5.1:runtime
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.12.22:runtime
[INFO] |  |  +- jakarta.inject:jakarta.inject-api:jar:2.0.0:runtime
[INFO] |  |  \- org.antlr:antlr4-runtime:jar:4.10.1:runtime
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:3.0.1:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:6.0.4:compile
[INFO] |  \- org.springframework:spring-aspects:jar:6.0.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:3.0.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:3.0.2:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.14.1:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.14.1:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.14.1:compile
[INFO] |  +- org.springframework:spring-web:jar:6.0.4:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:6.0.4:compile
[INFO] |     \- org.springframework:spring-expression:jar:6.0.4:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.18.0:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.18.0:compile
[INFO] +- org.apache.logging.log4j:log4j-jul:jar:2.18.0:compile
[INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.18.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:2.6.3:compile
[INFO] |  \- org.slf4j:jul-to-slf4j:jar:2.0.6:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:3.0.2:compile
[INFO] |  +- jakarta.servlet:jakarta.servlet-api:jar:6.0.0:compile
[INFO] |  +- jakarta.websocket:jakarta.websocket-api:jar:2.1.0:compile
[INFO] |  +- jakarta.websocket:jakarta.websocket-client-api:jar:2.1.0:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.5:compile
[INFO] |  +- org.eclipse.jetty:jetty-servlets:jar:11.0.13:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-http:jar:11.0.13:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-util:jar:11.0.13:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-io:jar:11.0.13:compile
[INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:11.0.13:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-servlet:jar:11.0.13:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-security:jar:11.0.13:compile
[INFO] |  |  |     \- org.eclipse.jetty:jetty-server:jar:11.0.13:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-xml:jar:11.0.13:compile
[INFO] |  +- org.eclipse.jetty.websocket:websocket-jakarta-server:jar:11.0.13:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-jakarta-client:jar:11.0.13:compile
[INFO] |  |  |  +- org.eclipse.jetty.websocket:websocket-jakarta-common:jar:11.0.13:compile
[INFO] |  |  |  +- org.eclipse.jetty.websocket:websocket-core-client:jar:11.0.13:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-client:jar:11.0.13:compile
[INFO] |  |  |     \- org.eclipse.jetty:jetty-alpn-client:jar:11.0.13:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-servlet:jar:11.0.13:compile
[INFO] |  |  |  \- org.eclipse.jetty.websocket:websocket-core-server:jar:11.0.13:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-annotations:jar:11.0.13:compile
[INFO] |  |     +- org.eclipse.jetty:jetty-plus:jar:11.0.13:compile
[INFO] |  |     |  \- org.eclipse.jetty:jetty-jndi:jar:11.0.13:compile
[INFO] |  |     +- org.ow2.asm:asm:jar:9.4:compile
[INFO] |  |     \- org.ow2.asm:asm-commons:jar:9.4:compile
[INFO] |  |        \- org.ow2.asm:asm-tree:jar:9.4:compile
[INFO] |  \- org.eclipse.jetty.websocket:websocket-jetty-server:jar:11.0.13:compile
[INFO] |     +- org.eclipse.jetty.websocket:websocket-jetty-api:jar:11.0.13:compile
[INFO] |     \- org.eclipse.jetty.websocket:websocket-jetty-common:jar:11.0.13:compile
[INFO] |        \- org.eclipse.jetty.websocket:websocket-core-common:jar:11.0.13:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:3.0.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:3.0.2:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-actuator:jar:3.0.2:compile
[INFO] |  \- io.micrometer:micrometer-observation:jar:1.10.3:compile
[INFO] |     \- io.micrometer:micrometer-commons:jar:1.10.3:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:jar:3.1.0:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:3.1.0:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-context:jar:3.1.0:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-crypto:jar:6.0.1:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-commons:jar:3.1.0:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.10.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-netflix-eureka-client:jar:3.1.0:compile
[INFO] |  +- com.netflix.eureka:eureka-client:jar:1.10.17:compile
[INFO] |  |  +- com.netflix.netflix-commons:netflix-eventbus:jar:0.3.0:compile
[INFO] |  |  |  +- com.netflix.netflix-commons:netflix-infix:jar:0.3.0:runtime
[INFO] |  |  |  |  +- commons-jxpath:commons-jxpath:jar:1.3:runtime
[INFO] |  |  |  |  +- joda-time:joda-time:jar:2.3:runtime
[INFO] |  |  |  |  +- org.antlr:antlr-runtime:jar:3.4:runtime
[INFO] |  |  |  |  |  +- org.antlr:stringtemplate:jar:3.2.1:runtime
[INFO] |  |  |  |  |  \- antlr:antlr:jar:2.7.7:runtime
[INFO] |  |  |  |  \- com.google.code.gson:gson:jar:2.9.1:runtime
[INFO] |  |  |  \- org.apache.commons:commons-math:jar:2.2:runtime
[INFO] |  |  +- com.thoughtworks.xstream:xstream:jar:1.4.18:compile
[INFO] |  |  |  \- io.github.x-stream:mxparser:jar:1.2.2:compile
[INFO] |  |  |     \- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |  |  +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] |  |  +- com.netflix.servo:servo-core:jar:0.12.21:compile
[INFO] |  |  |  \- com.google.guava:guava:jar:19.0:compile
[INFO] |  |  +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] |  |  |  \- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  |  +- com.google.inject:guice:jar:4.1.0:compile
[INFO] |  |  |  \- javax.inject:javax.inject:jar:1:compile
[INFO] |  |  \- org.codehaus.jettison:jettison:jar:1.4.0:runtime
[INFO] |  +- com.netflix.eureka:eureka-core:jar:1.10.17:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-starter-loadbalancer:jar:3.1.0:compile
[INFO] |     +- org.springframework.cloud:spring-cloud-loadbalancer:jar:3.1.0:compile
[INFO] |     |  +- io.projectreactor:reactor-core:jar:3.5.2:compile
[INFO] |     |  |  \- org.reactivestreams:reactive-streams:jar:1.0.4:compile
[INFO] |     |  \- io.projectreactor.addons:reactor-extra:jar:3.5.0:compile
[INFO] |     +- org.springframework.boot:spring-boot-starter-cache:jar:3.0.2:compile
[INFO] |     \- com.stoyanr:evictor:jar:1.0.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:3.0.2:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.0.2:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.7.0:compile
[INFO] |  |  \- net.minidev:json-smart:jar:2.4.8:compile
[INFO] |  |     \- net.minidev:accessors-smart:jar:2.4.8:compile
[INFO] |  +- org.assertj:assertj-core:jar:3.23.1:test
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.9.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.9.2:test
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  |  +- org.junit.platform:junit-platform-commons:jar:1.9.2:test
[INFO] |  |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.9.2:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.9.2:test
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.9.2:test
[INFO] |  +- org.mockito:mockito-core:jar:4.8.1:test
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.12.22:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.2:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:4.8.1:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.1:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-test:jar:6.0.4:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
[INFO] +- org.springframework.boot:spring-boot-test:jar:3.0.2:compile
[INFO] +- junit:junit:jar:4.13.1:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:2.2:test
[INFO] +- io.micrometer:micrometer-core:jar:1.8.1:compile
[INFO] |  +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] |  \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] \- io.micrometer:micrometer-registry-prometheus:jar:1.8.0:compile
[INFO]    \- io.prometheus:simpleclient_common:jar:0.16.0:compile
[INFO]       \- io.prometheus:simpleclient:jar:0.16.0:compile
[INFO]          +- io.prometheus:simpleclient_tracer_otel:jar:0.16.0:compile
[INFO]          |  \- io.prometheus:simpleclient_tracer_common:jar:0.16.0:compile
[INFO]          \- io.prometheus:simpleclient_tracer_otel_agent:jar:0.16.0:compile
[INFO]

Does anyone know which versions of the dependencies are compatible with each other?

Pablo Aragonés
  • 361
  • 6
  • 16

4 Answers4

6

I would hazard a guess this is because you have a property defined like so in your original project:

<log4j2.version>2.18.0</log4j2.version>

This is a very normal (and important!) thing to see with Spring Boot 2.x projects because of log4shell - by default Spring Boot 2.6.1 depends on a vulnerable version, so there must be some kind of property like this in the original pom that's bringing it up to 2.18.

Spring Boot 3.0.2 depends on log4j 2.19 which isn't vulnerable, so once again, you must have a property explicitly setting it to 2.18 for this to be an issue. Such a property isn't needed (and as you've found, is a regression that makes it incompatible anyway.)

Delete that explicit log4j2.version property, clean and rebuild, and you should be fine.

Michael Berry
  • 70,193
  • 21
  • 157
  • 216
  • Thank you very much! The problem is exactly that. Because of the vulnerabilities that appeared in log4j we had to manually modify the version and I hadn't taken it into account now – Pablo Aragonés Feb 09 '23 at 09:12
  • I am also having the same issue .log4j-api-2.17.1.jar is coming as part of dependecy management and I cannot control that .Any other solution rather than creating log4j2 – Pradeep May 13 '23 at 17:25
1

Does anyone know which versions of the dependencies are compatible with each other?

Spring-boot does. Stop forcing versions of dependencies managed by boot and you'll stop having incompatibility issues.

Also, you are changing a major version => expect breaking changes and modifications in your code.

Maybe should you refer to migration guide?

ch4mp
  • 6,622
  • 6
  • 29
  • 49
  • The proper way to do it is to use spring-boot-starter-parent in your pom.xml and let Spring Boot control all the JAR versions. – duffymo Jan 27 '23 at 14:48
1

During migration to Spring Boot 3

If someone is experiencing this issue after upgrading to spring boot 3, I suggest checking whether there is an explicit log4j2 version declaration.

If there is the declaration, either remove it or check which version is compatible with your target spring boot version and use it in the declaration.

Note: You can check the compatible version in this way: remove the declaration and check which version is pulled by the target spring boot version. Then use it.

HereAndBeyond
  • 794
  • 1
  • 8
  • 17
-2

Apparently, there is some kind of incompatibility with the log4j version so I had to force it to use version 2.19.0. With that, it worked.

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.19.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.19.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-jul</artifactId>
            <version>2.19.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.19.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>3.0.2</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-jul</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
Pablo Aragonés
  • 361
  • 6
  • 16
  • This really is nonsense. You are not migrating to boot 3, you are trying to use boot 3 with legacy libs. Why importing log4j starter, exclude most of its dependencies to import it manually with versions that are not the ones intended to be used with the boot version you are using? – ch4mp Feb 08 '23 at 18:14
  • The version of log4j that Spring Boot 3.0.2 uses is 2.19.0, so yes, it's the version that is intended to be used. – Pablo Aragonés Feb 09 '23 at 09:51