Spring boot application failed to start due to : Failed to instanceiate SLF4J LoggerFactory Reported [英] Spring boot application failed to start due to : Failed to instantiate SLF4J LoggerFactory Reported
问题描述
我正在编写示例代码,但在启动 Spring Boot 应用程序时出现以下错误,我已粘贴完整的错误堆栈和使用的 pom 文件.
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 是
<?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>
如果我将 1.3.5.RELEASE 更改为 1.3.2.RELEASE 它工作正常.我不明白为什么会发生这种情况,谁能解释一下
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
推荐答案
我在使用 1.4.2.RELEASE 时遇到了同样的问题.似乎以某种方式在 logback-core jar 中缺少某些类,这可能是启动 springboot 应用程序所需的.因此,我搜索了 logback 核心 jar 并将 maven 依赖项粘贴到我的 pom.xml 文件中,然后我的 spring-boot 启动了.如果需要,请确保清理项目.我的 pom 如下所示:-
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>
这篇关于Spring boot application failed to start due to : Failed to instanceiate SLF4J LoggerFactory Reported的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!