zoukankan      html  css  js  c++  java
  • SpringCloud项目里slf4j依赖冲突问题解决

    项目启动的时候会报SLF4J: Class path contains multiple SLF4J bindings.

    SLF4J: Found binding in [jar:file:.../ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:.../org/apache/logging/log4j/log4j-slf4j-impl/1.7.25/log4j-slf4j-impl-2.11.2.jar!/org/slf4j

    /impl/StaticLoggerBinder.class]

    网上搜了下,都是如下这种:

    1、“SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/D:/maven-3.3.3/m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/D:/maven-3.3.3/m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org

    /slf4j/impl/StaticLoggerBinder.class]”

    2、“

    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/G:/repo/repo-mvn-qingmu/ch/qos/logback/logback-classic
    /1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/G:/repo/repo-mvn-qingmu/org/slf4j/slf4j-log4j12/1.7.30
    /slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]”

    大致可以看到都是
    slf4j-log4j12-xxx.jar这种多出来的依赖,而我这个是log4j-slf4j-impl-2.11.2.jar,还是不一样的,因为我要用logback,
    所以要解决的肯定时log4j-slf4j-impl-2.11.2.jar依赖。

    解决过程:
    排查每个Module的依赖,idea里有工具可以看的,然后找到log4j-slf4j-impl-2.11.2.jar,看谁依赖了它,然后在其下加入:
    <exclusions>
                <exclusion>
                    <groupId>org.apache.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
            </exclusions>
  • 相关阅读:
    2019.1.3 WLAN 802.11 a/b/g PHY Specification and EDVT Measurement II
    L215 Visual impairment
    2019.1.3 WLAN 802.11 a/b/g PHY Specification and EDVT Measurement I
    L213
    firewall端口放行
    数据库迁移之mysql-redis.txt
    sort
    linux注释多行
    解决Nginx+Tomcat下客户端https请求跳转成http的问题
    监控zookeeper
  • 原文地址:https://www.cnblogs.com/emmalai/p/13450901.html
Copyright © 2011-2022 走看看