当前位置: 首页 > news >正文

Caused by: java.lang.IllegalArgumentException:LoggerFactory is not a Logback LoggerContext but Logba

启动springboot报如下错误:

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:/E:/software/maven_repo/org/slf4j/slf4j-log4j12/1.7.28/slf4j-log4j12-1.7.28.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

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:/E:/software/maven_repo/org/slf4j/slf4j-log4j12/1.7.28/slf4j-log4j12-1.7.28.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:280)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:104)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:219)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:200)
	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:70)
	at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:47)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
	at com.jd.sqltools.SqlToolsApplication.main(SqlToolsApplication.java:17)
	... 5 more

解决方法:
在spring -boot- starter上添加排斥来解决冲突

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
            <version>2.1.9.RELEASE</version>
</dependency>

添加下面的:

<!--            <exclusions>-->
<!--                <exclusion>-->
<!--                    <groupId>org.springframework.boot</groupId>-->
<!--                    <artifactId>spring-boot-starter-logging</artifactId>-->
<!--                </exclusion>-->
<!--            </exclusions>-->

相关文章:

  • C语言-快速排序
  • JAVA实现-URL短网址生成算法
  • JAVA-字符串连续出现字母进行压缩
  • C语言-字符串连续出现字母进行压缩
  • C语言数组引用
  • c语言中二维数据的存储方式
  • C语言-注释符
  • C语言%d%c%f
  • C语言-定义一个字符串
  • 2019
  • Mac上配置SublimeText运行C语言
  • C语言-按规则读取指定文件(2016.七)
  • C语言-统计文本文件中字母出现次数
  • warning: this program uses gets(), which is unsafe.
  • Linux查看一个文件夹下所有文件大小
  • C++类的相互关联
  • ES10 特性的完整指南
  • java8-模拟hadoop
  • JavaScript设计模式之工厂模式
  • Java知识点总结(JDBC-连接步骤及CRUD)
  • Linux后台研发超实用命令总结
  • PHP 使用 Swoole - TaskWorker 实现异步操作 Mysql
  • Puppeteer:浏览器控制器
  • 聊一聊前端的监控
  • 前端临床手札——文件上传
  • 手机端车牌号码键盘的vue组件
  • 微信支付JSAPI,实测!终极方案
  • 我看到的前端
  • 不要一棍子打翻所有黑盒模型,其实可以让它们发挥作用 ...
  • (2)关于RabbitMq 的 Topic Exchange 主题交换机
  • (3)选择元素——(14)接触DOM元素(Accessing DOM elements)
  • (pojstep1.1.1)poj 1298(直叙式模拟)
  • (二十一)devops持续集成开发——使用jenkins的Docker Pipeline插件完成docker项目的pipeline流水线发布
  • (附源码)springboot美食分享系统 毕业设计 612231
  • (附源码)计算机毕业设计ssm电影分享网站
  • (接口自动化)Python3操作MySQL数据库
  • (每日持续更新)jdk api之FileFilter基础、应用、实战
  • (三)Honghu Cloud云架构一定时调度平台
  • (转)大型网站的系统架构
  • .NET Compact Framework 多线程环境下的UI异步刷新
  • .net core 3.0 linux,.NET Core 3.0 的新增功能
  • .NET 中选择合适的文件打开模式(CreateNew, Create, Open, OpenOrCreate, Truncate, Append)
  • @ConditionalOnProperty注解使用说明
  • @Tag和@Operation标签失效问题。SpringDoc 2.2.0(OpenApi 3)和Spring Boot 3.1.1集成
  • [2013AAA]On a fractional nonlinear hyperbolic equation arising from relative theory
  • [2544]最短路 (两种算法)(HDU)
  • [ACM] hdu 1201 18岁生日
  • [acwing周赛复盘] 第 69 场周赛20220917
  • [BUUCTF 2018]Online Tool
  • [C/C++]数据结构 循环队列
  • [codevs 1515]跳 【解题报告】
  • [HackMyVM]靶场Crossbow
  • [Hive] 常见函数
  • [iOS]GCD(一)
  • [Linux]进程创建➕进程终止