0
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/classic/Logger
        at com.calamp.common.springboot.dbproperties.DBPropertySourceLoader.<clinit>(DBPropertySourceLoader.java:25)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:135)
        ... 28 more
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.Logger
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)
        ... 35 more
Kusum
  • 241
  • 5
  • 20

1 Answers1

1

Short answer: Your project is missing the logback-classic dependency:

<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.3</version>
    <scope>test</scope>
</dependency>

I guess you are not using any dependency management tool like Maven, Gradle or Ivy, that resolves transitive dependencies automatically. In your place I would look into those tools (it's probably best to start with Maven) instead of managing your dependencies yourself.

Tobi Nonymous
  • 581
  • 7
  • 14
  • I am using maven to build. Adding this dependency didn't help. Still getting the same issue. More over my understanding is for SpringBoot we just have to add the basic dependencies, rest it takes care of itself – Kusum Oct 16 '17 at 06:56
  • 1
    Issue resolved. For me https://examples.javacodegeeks.com/enterprise-java/slf4j/solving-failed-load-class-org-slf4j-impl-staticloggerbinder-error/ and https://stackoverflow.com/questions/7421612/slf4j-failed-to-load-class-org-slf4j-impl-staticloggerbinder links helped. slf4 dependency hierarchy was having conflicts. Excluding all and keeping 1 helped. – Kusum Oct 16 '17 at 11:20
  • Hey, this can indeed be an issue with slf4j. Spring Boot does manage it's own dependencies correctly, but other dependencies that you add might bring in incompatible versions of the same dependencies. This unfortunately happens easily with common dependencies, like logging frameworks. To prevent this in the future you can add the maven-enforcer-plugin (https://maven.apache.org/enforcer/maven-enforcer-plugin/) to your build. It will check your transitive dependencies for duplicates with differing versions and enforces you to resolve them. – Tobi Nonymous Oct 22 '17 at 10:01