Spring Boot - NoClassDefFoundError:ch/qos/logback/classic/Level

2024-04-16

我创建了一个普通的 Spring Boot 应用程序(1.5.9.RELEASE)但是当我Run As -> Spring Boot App(在 Eclipse Oxygen 中)我明白

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.
Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.<clinit>(LogbackLoggingSystem.java:66)
    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:422)
    at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:170)
    at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:160)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:229)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:209)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
    at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:292)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at demo.spring.boot.app.CourseApiApp.main(CourseApiApp.java:11)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.Level
    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)
    ... 19 more

pom.xml

<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>
  <groupId>demo.spring.boot</groupId>
  <artifactId>boot-demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
  </parent>

  <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
  </dependencies>

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

  <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

App

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CourseApiApp {

    public static void main(String[] args) 
    {
        SpringApplication.run(CourseApiApp.class, args);
    }
}

Remark

我也尝试过mvn clean package -> java -jar target/boot-demo.jar这给了我

Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: ch/qos/logback/classic/LoggerContext
    at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:59)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:50)
    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:179)
    at demo.spring.boot.app.CourseApiApp.main(CourseApiApp.java:11)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.LoggerContext
    at java.net.URLClassLoader$1.run(URLClassLoader.java:370)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 19 more
Caused by: java.util.zip.ZipException: invalid stored block lengths
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
    at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipInflaterInputStream.java:52)
    at sun.misc.Resource.getBytes(Resource.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:462)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    ... 25 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/classic/LoggerContext
    at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:59)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:50)
    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:179)
    at demo.spring.boot.app.CourseApiApp.main(CourseApiApp.java:11)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.LoggerContext
    at java.net.URLClassLoader$1.run(URLClassLoader.java:370)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 19 more
Caused by: java.util.zip.ZipException: invalid stored block lengths
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
    at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipInflaterInputStream.java:52)
    at sun.misc.Resource.getBytes(Resource.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:462)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    ... 25 more

扩展 Mark Bramnik 的答案,看起来你确实没有 logback,这很奇怪,因为spring-boot-starter-web依赖于spring-boot-starter-logging。只需尝试添加spring-boot-starter-logging到你的 POM 文件

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring Boot - NoClassDefFoundError:ch/qos/logback/classic/Level 的相关文章

  • 如何使用 mongoTemplate 实现 Mongodb Collection 的分页

    我是 mongoDb 中的菜鸟 我需要为任何特定集合实现分页 例如说 我有一个 Foo 集合 并且有一个返回 Foo 集合中所有记录的函数 public List
  • 如何在同一个项目中连接两个数据库MySQL和MongoDB?是否可以?

    目前我正在使用 Hibernate MySQL 和 Spring 配置对我来说运行良好 但是一旦我配置了另一个配置 mongo config xml 文件并尝试使用 mongodb 运行测试用例 它就显示创建名为 的 bean 时出错从第一
  • Java:使用类型参数访问私有构造函数

    这是后续这个关于java私有构造函数的问题 https stackoverflow com questions 2599440 accessing the private constructor 假设我有以下课程 class Foo
  • Java中的异常通知

    使用 Tomcat 的 Web 应用程序有什么好的异常通知系统吗 寻找与 exception notification 等价的库 这些库可作为 Rails 的插件使用 看一下http logging apache org log4j 1 2
  • 没有 if 条件(动态查询)或乱码的Where子句中的PreparedStatement“为null”

    假设我有这样的查询 SELECT FROM CUSTOMERS WHERE CUSTOMER ID 使用PreparedStatement 我可以绑定变量 pstmt setString 1 custID 但是 我无法通过以下绑定获得正确的
  • 从命令行将 clojure 源代码编译为类(AOT)(不使用 lein)

    我正在尝试将 clojure 源代码编译成类文件 并仅使用命令行运行它 没有 lein 也没有 可能 回复 我有 core cljsrc hello目录 src hello core clj 这是源代码 ns hello core defn
  • 如何抑制有关已弃用 api 的 javac 警告?

    当我编译时 javac 输出 Note Some input files use or override a deprecated API Note Recompile with Xlint deprecation for details
  • Spring:当我的类已经用@RestController注释时,为什么我仍然应该使用@RequestBody?

    我目前正在将 Java 和 Spring 用于我的 Web 服务应用程序 我正在使用 RestController希望消除使用注释的需要 ResponseBody and RequestBody注释 不幸的是 删除 RequestBody注
  • 谷歌gson LinkedTreeMap类转换为myclass

    我知道这个问题以前已经被问过 由于我对java和android的新手技能 我一个多星期都无法解决这个问题 我和我的一位朋友正在开发一个 Android 项目 其中有一些类似的事情 最奇怪的部分是 只有当我从 Google Play 商店下载
  • 在 Eclipse 中编写链接特定行的注释

    我正在 Java 中使用 Eclipse 并且处理很长的类 我需要这样的功能 在方法的顶部注释中 例如 有一个由该方法执行的操作列表 对于列出的每个操作 我想将注释的一部分 超链接 到相关代码的特定行 然后使用 Ctrl Click 到该行
  • JPA Criteria API 任意数量的联接/子查询

    我需要使用以下实体构建相交类型查询 为了清楚起见 减少了实体 Entity and other stuff public class Member Id private Long id private String name Entity
  • 强制预先加载原本延迟加载的属性

    我有一个 Hibernate 对象 它的属性都是惰性加载的 大多数这些属性是其他 Hibernate 对象或 PersistentSet 现在我想强制 Hibernate 一次性加载这些属性 当然 我可以 触摸 这些属性中的每一个objec
  • FileNotFoundException(系统找不到指定的路径)

    我得到这个例外 java io FileNotFoundException C filename xml The system cannot find the path specified 使用此代码 FileWriter fileWrit
  • 如何处理MaxUploadSizeExceededException

    MaxUploadSizeExceededException当我上传的文件大小超过允许的最大值时 会出现异常 我想在出现此异常时显示错误消息 如验证错误消息 我该如何处理这个异常 以便在 Spring 3 中执行类似的操作 Thanks 这
  • 三角形未在 OSX 上的 OpenGL 2.1 中绘制

    我正在学习有关使用 OpenGL 在 Java 中创建游戏引擎的教程 我正在尝试在屏幕上渲染一个三角形 一切运行良好 我可以更改背景颜色 但三角形不会显示 我还尝试运行作为教程系列的一部分提供的代码 但它仍然不起作用 教程链接 http b
  • Java 中的引用变量里面有什么?

    我们知道对象引用变量保存表示访问对象的方式的位 它不保存对象本身 但保存诸如指针或地址之类的东西 我正在阅读 Head First Java 第 2 版 一书 书中写道 第 3 章第 54 页 在 Java 中我们并不真正知道什么是 在引用
  • GWT 和身份验证

    保护 GWT Tomcat 应用程序执行身份验证和授权的最佳策略是什么 有两种基本策略 确保入口点安全 确保远程服务的安全 确保入口点安全 最简单的方法是使用常规 Web 应用程序安全工具限制对 GWT 生成的 html js 文件的访问
  • 返回数据集的 kSoap 和 .Net Web 服务

    我知道使用数据集是一个很大的罪恶 但由于该服务不在我的控制之下 并且创建代理服务的前景是不可能的 我想看看是否有人创建了可以使用 kSoap 序列化器反序列化的类结构 或者我是否吸错了东西 同时要启动它 看看是否可行 以下是预期的结果数据
  • 使用 Java 8 时间将时间从一个时区转换为另一时区

    我正在尝试将日期转换为GMT 5 30 to EST与java 8ZonedDateTime String inputDate 2015 04 30 13 00 DateTimeFormatter sourceFormatter DateT
  • 优化Gson反序列化

    优化反序列化的最佳方法是什么 我目前正在使用标准 Gson toJson 和 Gson fromJson 方法来序列化和反序列化一些复杂对象 我希望尽可能减少反序列化时间 如果重要的话 我的最复杂的对象包含 43 个变量 如果你想使用 Gs

随机推荐

  • Firebase - Firestore - 使用 collection.add() 获取密钥

    我在使用 Firebase 的新 Firestore 时遇到问题 情况 我有一个collection room 我创建房间collection room add room 我正在尝试做的事情 我需要更新一个房间 为此 我使用 collect
  • 示例 urllib3 和 python 中的线程

    我正在尝试在简单线程中使用 urllib3 来获取多个 wiki 页面 该脚本将 为每个线程创建 1 个连接 我不明白为什么 并永远挂起 urllib3 和线程的任何提示 建议或简单示例 import threadpool from url
  • 将多行转换为一行,并以逗号作为分隔符[重复]

    这个问题在这里已经有答案了 如果我发出SELECT username FROM Users我得到这个结果 username Paul John Mary 但我真正需要的是one所有值均以逗号分隔的行 如下所示 Paul John Mary
  • 计算网格上两点之间恰好有“n”个节点的最短路径

    我在网格上定义了以下 3D 表面 pylab inline def muller potential x y use numpy False Muller potential Parameters x float np ndarray or
  • 实体框架 Fluent API 映射简单的一对多关系

    我有两张桌子 文档 Id DocumentTypeId 标题 详细信息 文档类型 ID 名称 描述 DocumentTypeId 是引用 DocumentTypes 表的外键 IE 所有文件都可以应该 有一个分配给它们的类型 我有两节课 p
  • 多人台球游戏物理模拟[关闭]

    就目前情况而言 这个问题不太适合我们的问答形式 我们希望答案得到事实 参考资料或专业知识的支持 但这个问题可能会引发辩论 争论 民意调查或扩展讨论 如果您觉得这个问题可以改进并可能重新开放 访问帮助中心 help reopen questi
  • 将邻接矩阵转换为 Cytoscape 的 Edgelist(csv 文件)

    我的 csv 文件中有一个大的 200 列 行 邻接矩阵 这详细说明了个体之间的互动 我想将此文件转换为边缘列表 可以手动完成 但需要大量时间 下面显示了一小部分数据 第一个单元格是空格 A B C A 0 0 1 B 0 0 1 C 1
  • (0, _reactI18next.translate) 不是函数

    实际上 我是本地反应新手 在这里我尝试使用 react i18next 将语言更改为阿拉伯语 但在执行时出现以下错误 ReactNativeJS 0 reactI18next translate 不是一个函数 在 0 reactI18nex
  • AppDelegate 或 AppController

    在阅读可可教程时 我注意到一些教程使用AppDelegate还有一些AppController用于定义IBActions打开使用子类的各种窗口NSWindowController 这有某种经验法则吗 我创建一个仅是我的应用程序委托的类 并实
  • 如何使用 Visual Studio 2008 对 C# Web 服务进行单元测试

    您应该如何使用 Visual Studio 2008 对 C 中的 Web 服务进行单元测试 当我生成单元测试时 它会添加对 Web 服务类的实际引用 而不是 Web 引用 它设置以下中指定的属性 http msdn microsoft c
  • 检查 netcdf linux 库版本

    如何确定我的系统中安装了哪个版本的 netcdf 库 有命令行吗 我尝试搜索 netcdf 发现了一堆文件 但无法确定版本号 有没有命令可以检查已安装的任何版本 我在ubuntu上 netCDF 提供nc config用于此目的的命令行工具
  • 在 Rust 中应该如何进行指针算术?

    我知道答案是 你不应该 但为了争论 如何should你做吧 例如 如果您想编写一个替代方案Vec
  • Apache 服务器上的 React、js

    我正在一个react js项目中工作 我有一个安装了apache服务器的云服务器 我的问题是我可以在 apache 服务器上设置我的反应项目吗 正如达文 泰伦所说 react是一种浏览器技术 除了客户端浏览器从服务器下载应用程序之外 一切都
  • 用户模型中带有 uuid 列的 Laravel Sanctum 不保存 tokenable_id

    我尝试使用Laravel 8 x and Laravel sanctum 2 14 2验证我的 API 和 UUID 作为我的主密钥User model 我的定制PersonalAccessToken model use Illuminat
  • 在 Google Places Apis 中搜索特定城市内的位置

    我正在使用 Google Places Apis 来过滤特定城市内的结果 我能够过滤结果 但它也会显示该城市之外的结果 例如 如果我设置德里市的 LatLngBounds 并搜索纽约市的位置 它还给了我纽约市的结果 但纽约的 LatLng
  • 为什么要实现 IEquatable 接口

    我一直在阅读文章并在一定程度上理解接口 但是 如果我想纠正我自己的自定义 Equals 方法 似乎我可以在不实现 IEquatable 接口的情况下做到这一点 一个例子 using System using System Collectio
  • Python 如何在一行中分配多个变量?

    Python 在一行中分配多个变量实际上执行了哪些步骤 我以前经常做 A 0 A 1 A 1 A 0 来交换 但是最近在分配链表时遇到了一个错误 insert self gt node gt def insert next self nod
  • Spark中连接两个RDD

    我有两个 rdd 一个 rdd 只有一列 其他有两列来连接键上的两个 RDD 我添加了虚拟值 0 是否有其他有效的方法可以使用 join 来执行此操作 val lines sc textFile ml 100k u data val mov
  • conda 内部是如何工作的?

    我搜索了一段时间但找不到满意的答案 康达 http conda pydata org http conda pydata org 在内部工作 任何细节欢迎 此外 由于它与 python 无关并且显然工作得如此良好和流畅 为什么它不被用作像
  • Spring Boot - NoClassDefFoundError:ch/qos/logback/classic/Level

    我创建了一个普通的 Spring Boot 应用程序 1 5 9 RELEASE 但是当我Run As gt Spring Boot App 在 Eclipse Oxygen 中 我明白 SLF4J Failed to load class