zoukankan      html  css  js  c++  java
  • SpringBoot LoggerFactory is not a Logback LoggerContext but Logback is on the classpath

    SpringBoot 在启动项目的时候一起错误:

    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/Users/tongqinyuan/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/Users/tongqinyuan/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
    Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/Users/tongqinyuan/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Log4jLoggerFactory

    其实这是slf4j 日志包冲出导致 ,怎么查看包冲突呢?

    zookeeper包和junit包中都引入了日志包:

    <dependency>
    <groupId>org.apache.zookeeper</groupId>
    <artifactId>zookeeper</artifactId>
    <exclusions>
    <exclusion>
    <artifactId>slf4j-log4j12</artifactId>
    <groupId>org.slf4j</groupId>
    </exclusion>
    </exclusions>
    </dependency>
    安装maven help 插件,在pom.xml文件下点击dependency Analyzer分析查看冲突的包

    找到冲突后通过exclude排除掉就好了;

  • 相关阅读:
    MySQL新建用户,授权,删除用户,修改密码
    apache 压力测试
    wordpress设置导航栏
    关于PYTHON_EGG_CACHE无权限的问题
    ora 32021 设置参数时参数值长度超过255处理办法
    关于四字节字符入库时错误的解决方案(Incorrect string value: 'xF0x9Fx99x8F' for column 'Reply_Content' at row 1)
    Oracle Text Slowly
    Oracle Split Partitions
    下载有时失败
    Sytem 表空间很大
  • 原文地址:https://www.cnblogs.com/exmyth/p/11080547.html
Copyright © 2011-2022 走看看