SLF4J: Failed to load class的问题及解决
今天在做接口测试,一运行测试程序,就跳出这样一个大大的错误:
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread “main” java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
……
原来这是因为sl4j和log4j的不兼容导致的,具体处理方案如下:
1. 首先看看你工程中的sl4j-api的版本(比如我的是1.7.21),
2. 然后在http://mvnrepository.com/搜索slf4j-log4j12,会出现SLF4J LOG4J 12 Binding,
点击进入,会有很多版本的slf4j-log4j12,我们点击1.7.21版本的slf4j-log4j12进入详细信息页面,查看依赖的log4j,这个版本的slf4j-log4j12依赖的是1.2.17版本的log4j。
所以,我们在我们的工程中添加1.7.21版本的slf4j-log4j12和1.2.17版本的log4j,
问题完美解决。
我发现这篇文章比我讲的清楚,请参考:Failed to load class “org.slf4j.impl.StaticLoggerBinder问题故障的解决
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.
SLF4J: Failed to load class的问题及解决的更多相关文章
- Mina 中遇到SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Defaulting to no-op ...
- eclipse maven SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder
现象:运行eclipse maven build,console 有红色日志如下: SLF4J: Failed to load class "org.slf4j.impl.StaticLog ...
- Kafka生产者案例报警告SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
一.SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 这个报警告的原因简单来说时因为slf4j的版本 ...
- java项目跑起来报错: 程序报 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 错误
问题: 我用的是ssm框架结合, 利用junit测试的时候抛出 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder& ...
- 解决 程序报 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 错误
调试程序出现如下错误: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Default ...
- SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".错误的解决方法
1.今天新git下来的项目报错如下: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: ...
- SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”
1.问题描述: 我的项目是tcServer,在运行的之后出现如下错误: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBin ...
- SLF4J: Failed to load class "org.slf4j.impl.StaticLo
今天在修改项目是修改了pom中的配置启动后提示下面的错误, SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder&qu ...
- 解执行maven项目出现 SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”. error
最近再弄maven项目,运行起来没有问题,但是Console控制台会报错,比如说如下的问题异常提示: 由此我们可以看出,报出错误的地方主要是slf4j的jar包,而故障码中“Failed to loa ...
随机推荐
- SQL Server 删除表的默认值约束
首先查出字段的默认值约束名称,然后根据默认值约束名称删除默认值约束 ) select @constraintName = b.name from syscolumns a,sysobjects b w ...
- 695. Max Area of Island@python
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) conn ...
- MYSQL:WARN: Establishing SSL connection without server's identity verification is not recommended.
WARN: Establishing SSL connection without server's identity verification is not recommended. Accordi ...
- 4. COLLATION_CHARACTER_SET_APPLICABILITY
4. COLLATION_CHARACTER_SET_APPLICABILITY 表COLLATION_CHARACTER_SET_APPLICABILITY表示哪种字符集适用于哪种排序规则. INF ...
- 编写一个微信小程序
1.创建项目 2.创建目录及文件,结构如下:
- LeetCode(11) Container With Most Water
题目 Given n non-negative integers a1, a2, -, an, where each represents a point at coordinate (i, ai). ...
- python基础——4(数字、字符串、列表类型的内置方法介绍)
目录 一.可变与不可变类型 二.数字类型 三.字符串类型 四.列表类型 一.可变与不可变类型 可变类型:值改变,但是id不变,证明就是在改变原值,是可变类型 不可变类型:值改变,id也跟着改变,证明产 ...
- java基础之switch
switch 语句由一个控制表达式和多个case标签组成. switch 控制表达式支持的类型有byte.short.char.int.enum(Java 5).String(Java 7). swi ...
- [Go]GOPATH相关知识点
在成功安装好Go之后,执行命令 go env 就可以看到有关go的一些环境变量,其中比较关键的是GOROOT.GOPATH和 GOBIN 1.设置GOPATH环境变量有什么意义? GOPATH是指:指 ...
- [luoguP1783] 海滩防御(二分 || 最短路 || 最小生成树)
传送门 因为答案满足单调性,所以看到这个题,第一反应是二分,但是总是WA,也没有超时. 看了题解,,,,,, 这题刚开始很多人会想到二分,二分答案,然后看看是否能绕过所有信号塔,但是,这样写明显超时, ...