今天在做接口测试,一运行测试程序,就跳出这样一个大大的错误:

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的问题及解决的更多相关文章

  1. Mina 中遇到SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Defaulting to no-op ...

  2. eclipse maven SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder

    现象:运行eclipse maven build,console 有红色日志如下: SLF4J: Failed to load class "org.slf4j.impl.StaticLog ...

  3. Kafka生产者案例报警告SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

    一.SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 这个报警告的原因简单来说时因为slf4j的版本 ...

  4. java项目跑起来报错: 程序报 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 错误

    问题: 我用的是ssm框架结合, 利用junit测试的时候抛出 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder& ...

  5. 解决 程序报 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 错误

    调试程序出现如下错误: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Default ...

  6. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".错误的解决方法

    1.今天新git下来的项目报错如下: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: ...

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

    1.问题描述: 我的项目是tcServer,在运行的之后出现如下错误: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBin ...

  8. SLF4J: Failed to load class "org.slf4j.impl.StaticLo

    今天在修改项目是修改了pom中的配置启动后提示下面的错误, SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder&qu ...

  9. 解执行maven项目出现 SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”. error

    最近再弄maven项目,运行起来没有问题,但是Console控制台会报错,比如说如下的问题异常提示: 由此我们可以看出,报出错误的地方主要是slf4j的jar包,而故障码中“Failed to loa ...

随机推荐

  1. http协议基本认证Authorization

    http协议是无状态的, 浏览器和web服务器之间可以通过cookie来身份识别. 桌面应用程序(比如新浪桌面客户端, skydrive客户端)跟Web服务器之间是如何身份识别呢? 什么是HTTP基本 ...

  2. [CF] 950A Left-handers, Right-handers and Ambidexters

    A. Left-handers, Right-handers and Ambidexters time limit per test1 second memory limit per test256 ...

  3. 关闭 macOS Google Chrome 黑暗模式风格

    终端执行命令 defaults write com.google.Chrome NSRequiresAquaSystemAppearance -bool YES 恢复 defaults write c ...

  4. ubuntu mysql配置方案

    Ubuntu常用服务器环境搭建--MySQL篇 MySQL 1.安装MySQL apt-get update apt-get install mysql-server 2.配置MySQL vi /et ...

  5. Turtle库学习

    Python Turtle (Python绘图工具) 导入库 import turtle as t ps:为了方便调用我们这里给这个模块在本程序内重命名为 t 1. 画布 顾名思义就是用于绘图的区域 ...

  6. virtualbox创建虚机后配置网络上网

    一般来说常用的会配置两个网卡:(两个网卡应该在安装虚拟机之前就设置好) 1.NAT网络: 用于上外网: 2.host-only: 用于ssh连接,可以被其他人远程访问. 前提: 如图:在virtual ...

  7. js中的constructor 和prototype

    参考 http://www.cnblogs.com/yupeng/archive/2012/04/06/2435386.html function a(c){ this.b = c; this.d = ...

  8. HDU 5487 Difference of Languages

    Difference of Languages Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. ...

  9. Leetcode 301.删除无效的括号

    删除无效的括号 删除最小数量的无效括号,使得输入的字符串有效,返回所有可能的结果. 说明: 输入可能包含了除 ( 和 ) 以外的字符. 示例 1: 输入: "()())()" 输出 ...

  10. [luoguP1835] 素数密度_NOI导刊2011提高(04)(素数筛)

    传送门 数据辣么大,怎么搞?(L≤R≤2147483647) 注意到R-L≤1000000 所以可以直接筛R-L区间内的数, 但是需要用已知的小的素数筛, R-L区间内的大部分数肯定能用较小的素数筛去 ...