博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【原创】大叔经验分享(67)spring boot启动报错
阅读量:5145 次
发布时间:2019-06-13

本文共 3562 字,大约阅读时间需要 11 分钟。

spring boot 启动报错:

Caused by: 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:/usr/local/tomcat/webapps/app/WEB-INF/lib/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        at org.springframework.util.Assert.instanceCheckFailed(Assert.java:655)        at org.springframework.util.Assert.isInstanceOf(Assert.java:555)        at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:286)        at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:102)        at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:220)        at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:199)        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:69)        at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)        at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157)        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137)        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5139)        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)        ... 26 more

出现这个问题通常的原因工程中使用了多个开源jar,每个开源jar都有自己的日志实现方式,比如slf+log4j,slf+logback等,其中slf是一个抽象接口,有很多种实现,但是工程中只能有一种,解决方法在异常中已经提示出来:

Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/usr/local/tomcat/webapps/app/WEB-INF/lib/slf4j-log4j12-1.7.25.jar).

需要在logback和slf-log4j之间去掉一个,其中spring boot用的是logback,可以去掉slf-log4j;

通过

mvn dependency:tree

可以看到那些jar中依赖了slf-log4j,然后修改pom,将其排除掉

org.apache.hadoop
hadoop-client
2.6.5
org.slf4j
slf4j-log4j12

然后打包即可;

 

转载于:https://www.cnblogs.com/barneywill/p/11013719.html

你可能感兴趣的文章
iOS-沙盒目录
查看>>
对用户输入内容进行字数提示功能
查看>>
软件测试基础(第一阶段)
查看>>
2016级算法第二次上机-D.Bamboo的饼干
查看>>
#阿里云#云服务器部署可道云(KodExplorer)
查看>>
关于Mac上的开发工具
查看>>
Codeforces Round #288 (Div. 2)
查看>>
创业,首先你得讲好一个故事
查看>>
转】Maven学习总结(五)——聚合与继承
查看>>
Hadoop HBase概念学习系列之物理视图(又名为物理模型)(九)
查看>>
Hadoop HBase概念学习系列之HBase里的宽表设计概念(表设计)(二十七)
查看>>
Kettle学习系列之Kettle能做什么?(三)
查看>>
ExtJS 4.2 业务开发(一)主页搭建
查看>>
webpack Import 动态文件
查看>>
电脑没有安装iis,但是安装了.NET环境,如何调试网站发布的程序
查看>>
【Mac + GitHub】之在另一台Mac电脑上下载GitHub的SSH链接报错
查看>>
GDAL VC6.0 (1)
查看>>
java 随笔
查看>>
(转) objective-C中的接口@interface与泛型(id)
查看>>
Asp.Net缓存(2)
查看>>