java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory Spring boot 1.5.2 maven

spring boot slf4j
caused by: java lang classnotfoundexception ch/qos/logback/core/joran/spi/joranexception
liquibase java lang noclassdeffounderror org/slf4j/loggerfactory
org slf4j-impl staticloggerbinder maven
caused by: java lang classnotfoundexception org/slf4j/loggerfactory gradle
org slf4j loggerfactory getlogger maven
weblogic application moduleexception java lang classnotfoundexception org/slf4j/loggerfactory
java lang noclassdeffounderror failed resolution of: lorg/slf4j/loggerfactory

i'm following this tutorial to build a restful application. when i run this app (run as spring boot application) from spring tool suite it throwing error :

Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(
        at org.apache.commons.logging.LogFactory.getLog(
        at org.springframework.boot.SpringApplication.<clinit>(
        at webapp.Application.main(
        ... 6 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

same error also happen when i tried to use the project initializr (

my pom.xml is exact like the tutorial :

<?xml version="1.0" encoding="UTF-8"?>"> 4.0.0


<description>Demo project for Spring Boot</description>

    <relativePath /> <!-- lookup parent from repository -->





my dependency tree :

[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ wawa ---
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.2.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.24:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.24:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.24:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO] |  +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO] |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.7:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.7:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:4.3.7.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.2.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.2.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.2.RELEASE:test
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] |  |  \-
[INFO] |  +- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-test:jar:4.3.7.RELEASE:test
[INFO] \- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO]    +- net.minidev:json-smart:jar:2.2.1:test
[INFO]    |  \- net.minidev:accessors-smart:jar:1.1:test
[INFO]    |     \- org.ow2.asm:asm:jar:5.0.3:test
[INFO]    \- org.slf4j:slf4j-api:jar:1.7.24:compile
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.750 s
[INFO] Finished at: 2017-04-09T12:05:22+07:00

have tried this solution ClassNotFoundException: org.slf4j.LoggerFactory to add the latest jar to the classpath but it giving another error :

SLF4J: Class path contains multiple SLF4J bindings.

please throw some enlightment, i have been struggle for this issue for 3 days.

You have more than one logger in your dependencies and slf4j doesn't know which one to use. You should check Maven's dependency tree to fix it.

logback-classic <-> log4j-over-slf4j <-> jboss-logging (?)

You can exclude Spring Boot Logging (Logback by default) and declare Log4j2 manually:



SpringBoot app not working (Spring forum at Coderanch), I used Spring Initaliazr to download a Maven project, only selected Web. I added a test Failed to instantiate SLF4J LoggerFactory. Reported exception: java.lang​.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException. at org.​slf4j. at org.springframework.boot. Caused by: java.lang. i have tried both ways. with or without external JAR. yes for all i know this Maven should manage our dependencies and i also can't remove the jar in maven dependency except i add exclusion or change my pom.xml. may i know if you have same issue with me or you can run the apps normally if you just used the spring boot project starter from the initializr ? thanks – cumibulat Apr 11 '17 at 11:36

after few times of trial and error, i found out my slf4j jar is corrupted. i can see it when i run mvn package command and there's warning. i renamed the jar, then it will redownload the jar. as soon as the jar not corrupted, then the application face another error. i just followed this source Spring Boot: New Project - UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' to add hibernate validator in exclusion. after that i can run my app normally. thanks all.

Error when starting the Springboot examples, I am trying out the Springboot examples in the 6.3.1 documentation. In the pom I SpringApplication - Application run failed java.lang.NoClassDefFoundError: org/springframework/core/ErrorCoded at java.lang.ClassLoader. 5 in there. Can you also give us the output of mvn dependency:tree please? You have to provide one of the various SLF4J implementation .jar files in the classpath, as well as the interface .jar file. This is documented. improve this answer. answered Oct 17 '12 at 4:00. 235 silver badges. 392 bronze badges. The jar file, currently in the library is slf4j-api-1.6.1.jar, slf4j-jdk14-1.6.1.jar, slf4j-log4j12-1.6.1.jar and

Add missing Logback JARs into the classpath. The JARs can be found in Maven Central.Following are the two jar files

  1. logback-core-1.0.13.jar
  2. logback-classic-1.0.13.jar

Spring Boot Log4j 2 example –, <project xmlns="" [INFO] \- org.​springframework.boot:spring-boot-starter-log4j2:jar:2.1.2. [INFO] +- org.apache.​logging.log4j:log4j-slf4j-impl:jar:2.11.1:compile GetMapping; import java.util. java 8 lambda, no need to check log level logger.debug("Hello from Log4j  SLF4J API Module. Logging Frameworks. api logging slf4j. 40,882 artifacts. Redhat GA (22) JBoss 3rd-party (3)

You may use




Slf4j Spring Boot Example, Eclipse IDE; Apache Maven; JDK 1.8; Slf4j 1.7.22; Spring Boot 1.5.3 import java.lang.invoke.MethodHandles;. import org.slf4j.Logger;. The configuration is Logback-specific but works seamlessly with SLF4J. With the proper dependencies and configuration in place, the same code from previous sections can be used to handle the logging. 4. The Log4j Setup. In the previous sections, we covered a use-case where SLF4J “sits” on top of the particular logging implementation. Used

It was happening with me too, I changed the spring-boot version for a previous version and it works. I changed the 1.5.6-RELEASE to 1.3.5-RELEASE

SLF4J News, What I am trying to do is write a simple Spring Boot Microservice which uses STOMP for <project xmlns="" <artifactId>​spring-boot-starter-parent</artifactId> <version>1.5.2. <url>https://repo.spring.​io/libs-release</url> </pluginRepository> Logger; import org.slf4j. Note that, if we don't exclude commons-logging and don't add jcl-over-slf4j dependency then we can still use SLF4J API in our code, but Spring internal logging will still be going through JCL, which will ultimately end up Log4j logs, so output will be the same in that case. But that option is not recommended.

Errors on using @EnableSwagger 2 with version 2.9.0 · Issue #2501 , Refactored the fluent-api in org.slf4j. Removed unnecessary export of org.slf4j.​jul package in module-info.jar of House cleaning of our project's Maven pom.​xml files, an initiative undertaken by The logger field (of type java.util.logging. if no binding can be found, SLF4J will no longer throw a NoClassDefFoundError .

spring-projects/spring-boot, EnableAdminServer; import org.springframework.boot. Files\Java\jdk1.8.0_171​\jre\lib\deploy.jar;C:\Program \.gradle\caches\modules-2\files-2.1\io.springfox\​springfox-spring-web\2.8.0\ \da76ca59f6a57ee3102f8f9bd9cee742973efa8a\​slf4j-api-1.7.25.jar It seems 2.9.0 not updated to maven central.

When uploading them to my existing mvn project I had no errors. JarLauncher.​main( > Caused by: java.lang.NoClassDefFoundError: org/​apache/commons/logging/LogFactory > at org.springframework.boot. -1.0.jar!/​org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in 

  • i have add your suggested exclusions but still throwing same error. should i add external jar (slf4j) or just used from the maven dependency ?
  • No, you should never add external JAR files. Always rely on Maven to manage the dependancies. Do you have external JARs? If so, this is certainly your issue. Because my suggestion above should fix your problem, unless you have another one hidden somewhere in your code which is not visible in the question.
  • i have tried both ways. with or without external JAR. yes for all i know this Maven should manage our dependencies and i also can't remove the jar in maven dependency except i add exclusion or change my pom.xml. may i know if you have same issue with me or you can run the apps normally if you just used the spring boot project starter from the initializr ? thanks
  • I have pretty large projects with a similar POMs and no conflicts. When you say that you can't remove the JAR, you always can; push it to your Maven repository and use it as a normal dependency. You should check inside of that JAR, if it contains other loggers.