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排除掉就好了;
最新文章
- iOS报错[__NSCFNumber length]: unrecognized
- java-并发-不可变对象
- px与rem关系及转换
- TF-IDF 加权及其应用
- angular入门系列教程1
- WCF - IIS Hosting
- Kickstart + http Linux自动化部署服务端
- Android studio mac版本快捷键
- c++ map unordered_map
- 解析 .Net Core 注入 (3) 创建对象
- Activiti 5.22.0 之自由驳回任务实现(亲测)
- Vegas Pro 15软件界面对比
- 通过修改配置文件修改MySQL的时区设置
- json信息的后台到前台的传输
- php魔术方法__tostring的应用
- OpenCV——查找、绘制轮廓
- mysql/mariadb学习过程中出现的问题与解决
- 【转】Java常量池详解
- appium+python自动化26-模拟手势点击坐标(tap)
- Time Zone 【模拟时区转换】(HDU暑假2018多校第一场)