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>
  • 相关阅读:
    sql 注入工具sqlmap的使用
    sql 注入手工实现二
    sql 注入手工实现
    虚拟机和docker简单对比
    22 MySQL--01mysql数据库的安装
    21 Linux的目录结构与目录管理
    20 Linux基础命令--01
    19 shell脚本--010awk
    18 shell脚本--009数组与字符串
    17 shell脚本--008函数
  • 原文地址:https://www.cnblogs.com/justlove/p/7637681.html
Copyright © 2011-2022 走看看