LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback
今天在启动之前的Spring Boot项目的时候出现了这样的异常:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/H:/maven/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:/H:/maven/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]
Disconnected from the target VM, address: '127.0.0.1:6264', transport: 'socket'
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:/H:/maven/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.Log4jLoggerFactoryat org.springframework.util.Assert.instanceCheckFailed(Assert.java:637)at org.springframework.util.Assert.isInstanceOf(Assert.java:537)at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:274)at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:99)at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:191)at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:170)at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:68)at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
显然是jar包冲突了,联想到前几天添加了ZooKeeper的相关依赖,将相关依赖排除即可。
解决方式一:
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><exclusions><exclusion><groupId>ch.qos.logback</groupId><artifactId>logback-classic</artifactId></exclusion></exclusions>
</dependency>
或者
如果你项目的日志是基于Spring Boot的日志来的,建议不要使用这个方法。
解决方式二:
排除ZooKeeper中的依赖:
解决方式三:
依赖上移,我的ZooKeeper依赖是在service模块中,将其移至父工程中即可。
LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback相关推荐
- 分布式系统:SpringBoot中Dubbo以及Zookeeper依赖包冲突 LoggerFactory is not a Logback LoggerContext but Logback
目录 QUESTION:SpringBoot中Dubbo以及Zookeeper依赖包冲突? ANSWER: 导入curator-recipes依赖: 排除依赖: QUESTION:SpringBoot ...
- springboot启动报错LoggerFactory is not a Logback LoggerContext but Logback...
由于springboot默认日志组件为logback,当时项目使用的为log4j,在打war包到tomcat启动时报如上错误. 原因:log4j日志组件和自带logback日志组件冲突. 解决方法: ...
- slf4j的jar包冲突:LoggerFactory is not a Logback LoggerContext but Logback is on the classpath
今天运行项目一直报上面那个错误,自己项目中有dozer的jar包 <dependency><groupId>net.sf.dozer</groupId><ar ...
- 【Spring 】启动报错 LoggerFactory is not a Logback LoggerContext but Logback...
2.背景 写了一个程序,但是突然报错 这个是因为日志冲突,排除一个就好了. <dependency><groupld>orgapachehadoop
- 解决LoggerFactory is not a Logback LoggerEither remove Logback or the competing implementation (class
一个项目引入了amqp以后报错,疑似包冲突,最后利用dependency analyzer终于解决了. 问题: 原依赖: <dependency><groupId>org.sp ...
- java中读取logback日志文件_java 控制台 System.out日志输出到logback文件里
使用spring boot2.0.7开发项目,由于调用了其他组c++的本地方法,他们的日志是直接在控制台打印日志的,而我们这边统一用logback记录日志,然后logback配置后控制台的日志没有记录 ...
- Springboot工程logback和log4j冲突问题的解决。
背景 刚入职,最近搭建一个工程.搭建过程需要引入公司已经封装好的一些jar包.引入jar后启动就会报错.报错信息如下 Exception in thread "restartedMain&q ...
- springboot 日志问题记录
问题:新建工程busr,采用pandora boot,引入了需要的包,简单写了点代码发布, spring-boot启动报错: Caused by: java.lang.IllegalArgumentE ...
- SpringGateway与Zookeeper的Maven冲突
原Maven依赖: <!--添加zookeeper3.4.14版本--> <dependency><groupId>org.apache.zookeeper< ...
- 工作中的一些错误解决记录
1) 2018-10-19 CDH OOZIE UI页面打不开: 解决: 把下载好的ext-2.2.zip拷贝到Oozie主机的/var/lib/oozie目录下 运行命令unzi ...
最新文章
- 当前国内有哪些公司是做OKR管理软件做的比较好的?
- javax.validation.ParameterNameProvider
- 使用Backtrace函数打印调用栈 - Debug居家必备
- Java集合(一):Java集合概述
- 有趣的天平秤假币问题
- html文字竖直书写,css 文字竖直居中的写法和图片垂直居中代码(图文)
- oracle找出大于1g的表,表占用太大空间问题!
- Powershell基本命令总结(更新中)
- 【洛谷习题】又是毕业季II
- iperf3使用方法 linux,iperf3命令使用
- 阿里云SLS日志服务
- 大小和尚共有100人php,古今诗趣(一)· 数字诗
- Vijos 1004 伊甸园日历游戏 博弈
- xmarks 又可以使用了. 太棒了
- 微信加菲猫连接服务器失败,加菲猫微信表情包
- 【BZOJ3837】[Pa2013]Filary 随机化神题
- 【C语言】交换函数(swap)
- 18年春季第一题 PAT甲级 1144 The Missing Number (20分) 上限感很重要
- 大学四年,我是如何学习编程的?
- 投:分众传媒相关文章