springboot启动you will need to add ‘org.slf4j‘ to prefer-application-packages异常解决

摘自个人印象笔记2020-09-12内容:[https://app.yinxiang.com/fx/6c3c7d9d-d5e5-4e5b-b2a1-33d6f29c48a7](https://app.yinxiang.com/fx/6c3c7d9d-d5e5-4e5b-b2a1-33d6f29c48a7)
启动异常:
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.SimpleLoggerFactory loaded from file:/code/project/poly-mall/newuser-server/WEB-INF/lib/slf4j-simple-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.SimpleLoggerFactory

调整pom文件为如下:


org.springframework.boot
spring-boot-starter-web


ch.qos.logback
logback-classic


org.springframework.boot
spring-boot-starter-tomcat




javax.servlet
javax.servlet-api
3.1.0
provided



ch.qos.logback
logback-classic
1.2.3


org.apache.logging.log4j
log4j-slf4j-impl


自定义依赖包中排除:

org.slf4j
slf4j-log4j12


org.slf4j
slf4j-simple

你可能感兴趣的:(JAVA,spring,boot,后端,java)