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

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.

最新文章

  1. Entity Framework 实体框架的形成之旅--实体框架的开发的几个经验总结
  2. Spring 定时任务2
  3. DFD数据流程图
  4. aspose.cells 模版
  5. C# 深入浅出 委托与事件
  6. HTML5 Canvas Arc Tutorial
  7. getgrgid()函数
  8. ORA-00942:表或视图不存在(低级错误)
  9. 201521123057 《Java程序设计》 第6周学习总结
  10. linux一键安装
  11. 如何学习 MFC ?
  12. shell的进度条【转】
  13. Excel导出采用mvc的ExcelResult继承遇到的问题
  14. Facebook主页照片和封面照片的尺寸要求
  15. 用户Cookie和会话Session、SessionId的关系
  16. angularJS module里的'服务'
  17. 比较windows phone程序启动和android程序启动原理
  18. sharepoint content type publishing
  19. 四、ansible主机组定义
  20. [C++] Memory_stack_heap

热门文章

  1. python-opencv 分离图片(视频)中的某一颜色物体
  2. 洛谷P1421 小玉买文具
  3. ajax 实现订单商品数量的增减及订单的删除进行异步更新界面
  4. 树莓派搭建Seafile个人网盘
  5. Go:单元测试
  6. xenserver tools 安装
  7. 二手GTX650
  8. C语言程序内存分布
  9. DEVExpress中BarItem的使用2
  10. 【Codeforces 25C】Roads in Berland