zoukankan      html  css  js  c++  java
  • SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

           最近在学习SpringBoot时,有的时候明明项目运行起来没有问题,但是Console控制台会报错,比如说如下的问题异常提示:

    image

            由此我们可以看出,报出错误的地方主要是slf4j的jar包,而故障码中“Failed to load class ’org.slf4j.impl.StaticLoggerBinder‘”的意思则是“加载类文件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.

    翻译过来如下所示:

    这个错误是当org.slf4j.impl报道。StaticLoggerBinder类不能被加载到内存中。发生这种情况时,无法找到合适的SLF4J绑定类路径。slf4j-nop.jar放置一个(且只有一个), slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar 或 logback-classic.jar 的类路径应该解决这个问题。

            所以说解决的办法就是在Maven工程的pom文件中随便加载一个上述的包文件之一的依赖就可以了(且只有一个),此时我加载的是“slf4j-nop-1.7.2.jar”包文件的依赖,然后整个项目就可以编译无异常通过了。

      1 <dependency>
      2     <groupId>org.slf4j</groupId>
      3     <artifactId>slf4j-nop</artifactId>
      4     <version>1.7.2</version>
      5 </dependency>
  • 相关阅读:
    事务的隔离级别
    常用linux命令
    cpu.load avg和cpu使用率的区别
    【Leetcode】55. Jump Game
    【Leetcode】322. coin-change
    34.find-first-and-last-position-of-element-in-sorted-array
    【LeetCode】56.merge-intervals
    Leetcode】210.course-schedule-ii
    基于Thread实现自己的定时器Timer
    Boost--内存管理--(1)智能指针
  • 原文地址:https://www.cnblogs.com/justlove/p/7637681.html
Copyright © 2011-2022 走看看