Jerin Joseph
Jerin Joseph

Reputation: 797

Spring boot application failed to start due to : Failed to instantiate SLF4J LoggerFactory Reported

I was working on a sample code and I get the following error when starting the spring boot application I have pasted the complete error stack and the pom file used.

  Failed to instantiate SLF4J LoggerFactory
    Reported exception:
    java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
        at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:273)
        at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:191)
        at com.hellokoding.auth.WebApplication.main(WebApplication.java:16)
    Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 9 more

pom.xml is

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>auth</artifactId>
    <name>auth</name>
    <description>auth</description>
    <packaging>war</packaging>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.5.RELEASE</version>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>
.................

</project>

If I change the 1.3.5.RELEASE to 1.3.2.RELEASE it works fine. I do not understand why this happen can anybody please explain

Upvotes: 0

Views: 2438

Answers (1)

Neo Ravi
Neo Ravi

Reputation: 417

I was facing the same issue while I was using 1.4.2.RELEASE. It seems that somehow some classes are missing in logback-core jar which may be required to start the springboot application. so, I searched for logback core jar and pasted the maven dependency in my pom.xml file and my spring-boot started. Make sure to clean the project, if required. My pom is as given below:-

<modelVersion>4.0.0</modelVersion>
<groupId>io.javavbrains.springbpptquickstart</groupId>
<artifactId>CourseApi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Java Brains Course API</name>


<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.2.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>1.2.3</version>
    </dependency>

</dependencies>
<properties>
    <java.version>1.8</java.version>
</properties>

Upvotes: 2

Related Questions