springboot项目启动异常原因

错误:springboot项目启动异常原因_第1张图片
解决办法:
1,在原有的包后注明不再使用slf4j-log4j12方法:
在pom文件中增加:


org.slf4j
slf4j-log4j12


springboot项目启动异常原因_第2张图片
删除:

  
  
  

错误日志: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:/home/huser/.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.Log4jLoggerFactory at org.springframework.util.Assert.instanceCheckFailed(Assert.java:696) at org.springframework.util.Assert.isInstanceOf(Assert.java:596) at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:281) at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:104) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:239) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:220) 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:305)

另外,发现一个很好的找包依赖的方法,如https://blog.csdn.net/zhanggonglalala/article/details/88953345
中第三条所介绍:
三、直接在IDEA依赖图中进行修改

你可能感兴趣的:(Java,spring,boot,maven,log4j2)