Tariq
Tariq

Reputation: 2569

Maven - Failed to load class "org.slf4j.impl.StaticLoggerBinder"

I have recently installed Maven on my windows based laptop. But getting following error when running mvn just to test my installation:

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.

Whoever when running mvn -version I am getting appropriate response:

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T22:29:23+05:00)
Maven home: C:\apps\Maven
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

Note that I am getting exactly same error when running mvn install, mvn package, mvn clean or any other Maven target in my maven project, while project doesn't have any dependency for SLF4J.

Upvotes: 1

Views: 3556

Answers (1)

mystarrocks
mystarrocks

Reputation: 4088

This error usually means that you have the slf4j-api library in your classpath without an SLF4J binding associated with it. Make sure to have exactly one of these binding jars in your classpath alongside the slf4j-api jar (also make sure the versions are compatible):

  • slf4j-nop.jar,
  • slf4j-simple.jar,
  • slf4j-log4j12.jar,
  • slf4j-jdk14.jar or
  • logback-classic.jar

The SLF4J lists all such error codes on its FAQ page. You can find this issue and resolution documented here.

IIRC, this is merely a warning and won't affect your build process - or does it? If you didn't really mean to include the SLF4J libraries in your classpath, they would have been pulled in transitively. Use the mvn dependency:tree or the m2eclipse's Dependency Hierarchy view to find the source of these the SLF4J related libraries and exclude them.

Upvotes: 3

Related Questions