SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder

本文详细介绍SLF4J中出现的'org.slf4j.impl.StaticLoggerBinder加载失败'问题,分析其原因,引用官网解释,并提供Maven工程中解决此类问题的pom配置实例。

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder

问题介绍:

在这里插入图片描述

问题分析:

根据报错提示,我们可以知道出错的原因是“加载类文件org.slf4j.impl.StaticLoggerBinder时失败”,而出错的地方主要是在于slf4j的jar包。

官网解释:

This error is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory. This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
————————————————
翻译成中文的意思就是:
日志含义当org.slf4j.impl. py文件运行时,报告此错误。StaticLoggerBinder类无法加载到内存中。当在类路径上找不到合适的SLF4J绑定时,就会发生这种情况。把slf4j-nop.jarslf4j-simple.jarslf4j-log4j12.jarslf4j-jdk14.jarlogback-classic.jar中的一个(且只有一个)放在类路径上就能解决问题。

解决方案:

在Maven工程的pom文件新增一个上述的包文件之一的依赖配置,如下:

<dependency>  
  <groupId>org.slf4j</groupId> 
  <artifactId>slf4j-nop</artifactId> 
  <version>1.7.2</version> 
</dependency>

Over !!!

参考资料:Maven项目报错:“ SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder ”解决办法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ONLY_AIGC

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值