-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
log4j-spring-boot gives error #2384
Comments
Which Spring Boot 3.x artifact depends on The functionality of The |
The stack trace you deleted seems like a problem with Spring Boot's version of our lookup. Unlike our version it fails if there is no environment. Such an occurrence is pretty natural. If you use a Edit: For posterity's sake, this is the stack trace in question. Since it does not contain any of your classes I assume you don't have anything against keeping it:
|
Yes after removing log4j-spring-boot and renaming log4j-spring.xml issue is resolved. Thanks for the help. |
Spring Boot should remove log4j-spring-boot from their declaration. It will cause errors to be reported immediately when upgrading the Spring Boot version from 2.x to 3.x. |
Does any Spring Boot 3.x artifact or starter depend on Remark: since Maven doesn't have a notion of "conflicting dependencies", it is impossible for Spring Boot to automatically remove |
In Spring 2.x, we use the following declaration (without specifying the version): But you are right, I just checked, and I found that they don't include the individual |
Yes, and we also can not remove |
Description
I have spring boot project, recently upgraded to version 3.2.2 from 3.1.0. We are using dependency "org.apache.logging.log4j:log4j-spring-boot" in our project.
After upgrading to 3.2.2 we are getting below exception when started the the application.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.boot.SpringApplication.(SpringApplication.java:202)
On analyzing found that spring-boot-3.1.0 imports dependency log4j-spring-boot with version 2.20.0
and spring-boot-3.2.2 imports dependency log4j-spring-boot with version 2.21.1
If I use version 2.20.0 explicitly for log4j-spring-boot with spring-boot 3.2.2, application works as expected with warning in logs "Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts".
As per initial observation it seems 2.21.1 version of log4j-spring-boot have some issue which throws NoClassDefFoundError.
Configuration
Version: 2.21.1
JDK: JDK-17
The text was updated successfully, but these errors were encountered: