一、问题的现象

1、使用spring-boot-starter-web重构项目时,遇到报错:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/mou/.m2/repository/org/slf4j/slf4j-log4j12/1.7.30/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/mou/.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:/C:/Users/mou/.m2/repository/org/slf4j/slf4j-log4j12/1.7.30/slf4j-log4j12-1.7.30.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:702)at org.springframework.util.Assert.isInstanceOf(Assert.java:602)

二、解决方案

原因:看冲突的内容应该是指我的旧项目和Spring Boot中自带的slf4j包冲突了。
解决:去除Spring Boot Web启动器中的日志依赖

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><exclusions><exclusion><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></exclusion><exclusion><groupId>ch.qos.logback</groupId><artifactId>logback-classic</artifactId></exclusion></exclusions></dependency>

三、排查方式

IDEA开发工具可以右键POM文件,查看导入的依赖,再按ctrl+F可以查看依赖的位置。

关于Spring Boot报错:LoggerFactory is not a Logback LoggerContext but Logback is on the classpath相关推荐

  1. 解决Spring Boot报错Mapped Statements collection already contains value for...Error while adding the mapp

    解决Spring Boot报错Mapped Statements collection already contains value for...Error while adding the mapp ...

  2. Spring Boot 报错ThreadPoolTaskExecutor : Shutting down ExecutorService ‘applicationTaskExecutor‘

    问题 Spring Boot 报错ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 原因 ...

  3. spring Boot报错 之五种(不打包运行)

    Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as ...

  4. spring Boot 报错Failed to introspect Class [xxx] from ClassLoader

    因为之前把redis单打成jar包放入一个项目,然后该项目的jar包在cmd命令行运行报错,该问题主要原因是:因为redis包是外部包,spring在加载bean时,找不到对应的class文件, 部署 ...

  5. spring boot报错:Parameter 4 of constructor in xx required a bean of type ‘xx‘ that could not be found.

    spring boot 项目启动服务时,报错: 根据报错提示,一直认为是 SpringBootApplication 没有扫描到对应的 bean 路径. 最后,仔细排查发现是粗心的问题,自定义的常量没 ...

  6. Spring Boot 报错:Failed to configure a DataSource

    一.报错信息如下 这个异常在Spring Boot中比较常见,在初次完成项目的构建后,因为Spring Boot 的自动配置时,检查到我们添加了数据源(Mysql)的相关的依赖包,结果在我们的配置文件 ...

  7. 【Spring] Spring boot 报错 Unable to start ServletWebServerApplicationContext due to missing ServletWe

    1.概述 spring 报错如下 Error starting ApplicationContext. To display the conditions report re-run your app ...

  8. 解决: Spring Boot报错 This application has no explicit mapping ... a fallback

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 启动spring boot然后访问页面的时候,出现如下错误: Whitelabel Error Pa ...

  9. 问题|启动Spring Boot报错-4处 @Spring Boot

    目录 描述 问题 问题1:Application failed to start with classpath 问题2:Unable to load authentication plugin 'ca ...

  10. spring boot 报错:extShutdownHook ...was destroying!

    springboot 启动报这个错的解决办法是: 在pom里引入: <dependency><groupId>org.springframework.boot</grou ...

最新文章

  1. 解决mongodb ISODate相差8小时问题
  2. Recursive Bubble Sort(递归冒泡排序)
  3. 【今日互联网大事儿】传百度要投资Uber呢~
  4. PHP 完整实战23种设计模式
  5. SharePoint 2013 基于表单 Membership 的身份验证
  6. POJ 1759 Garland
  7. java参数可变方法
  8. 新版UNITY游戏(IL2CPP类型)使用内嵌型机器翻译插件XUnity.AutoTranslator的食用方法
  9. 如何打开后缀为.xps的文件?
  10. HDS AMS 更换控制器和控制器缓存
  11. c语言break可以跳出for循环吗,怎么跳出for循环
  12. 正确的洗澡顺序,据说99%的人都是错的。。
  13. Ansys workbench分析应用基础(2)
  14. 【计算机网络】因特网和互联网的区别
  15. 产品经理PM相关书籍---推荐阅读
  16. 基于单片机的血压计c语言,基于单片机血压计的设计
  17. 前端技能树,面试复习第 19 天—— React 基础一点通
  18. 成立了一个软件工作室,但是如何才能接到项目呢?
  19. 初学FS4412——简介和点灯
  20. 乐高大颗粒作品10:滑板车的搭建

热门文章

  1. BERT模型—2.BERT模型预训练与微调
  2. One Piece Introduction
  3. css中子元素设置margin-top会影响到父元素
  4. w ndows安装,Win7旗舰版Wndows Virtual PC虚拟机安装教程.doc
  5. 项目管理中用什么工具可以增强团队协作?
  6. 宝塔linux 云锁安装卸载,Centos宝塔安装云锁带自编译好模块Nginx
  7. image库的使用笔记
  8. 雨课堂《工程伦理》期末答案
  9. kali linux无线驱动安装,Kali Linux安装 WIFI无线网卡驱动 教程
  10. PostgreSQL下载、安装和配置使用