Link to home
Start Free TrialLog in
Avatar of gp
gpFlag for United States of America

asked on

Error - LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation

Hi,

I am seeing below type of error in my intellij IDEA console when i start my spring boot main application
I am using JDK 17 and spring boot 3.0.5 and maven 3.9.1 currently.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.helpers.NOPLoggerFactory loaded from file:/C:/Users/xyz/.m2/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.helpers.NOPLoggerFactory
   at org.springframework.util.Assert.instanceCheckFailed(Assert.java:713)
   at org.springframework.util.Assert.isInstanceOf(Assert.java:632)

Open in new window

Please advise.

Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I've already commented on this issue (related) in one of your (many) earlier questions. You ignored it
Avatar of gp

ASKER

It looks like Java thinks you want Logback logging, not Log4jx - do you?
I am not very clear on above comment. How to resolve this issue? Looks like logback getting from multiple jars and multiple places. Does spring boot 3.0.5 also populates Logback jar and slf4j jar and log4j jar. Lot of logging jars getting conflicts. Do I need to do any kind of exclusions? Please advise.
Which logging do you want - Logback or Log4J?
Avatar of gp

ASKER

I like to have Logback
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gp

ASKER

This worked after removing some of old jars from .m2 repository folder. Thank you for your help with this issue
:)