zoukankan      html  css  js  c++  java
  • 【Exception】LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.SimpleLoggerFactory

    1.当我对springboot项目进行部署到tomcat的操作时,报了以下异常

    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:/Users/design/work/tomcat-9.0.19/webapps/OA/WEB-INF/lib/slf4j-simple-1.7.26.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
    	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:219)
    	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:198)
    	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)
    	... 38 more
    

      

    分析可知是依赖问题,通过idea找到slf4j-simple,并去掉依赖

     <dependency>
                <groupId>org.solar</groupId>
                <artifactId>solar-core</artifactId>
                <version>1.1</version>
                <exclusions>
                    <exclusion>
                        <artifactId>slf4j-simple</artifactId>
                        <groupId>org.slf4j</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
    

      

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <exclusions>
                    <exclusion>
                        <artifactId>log4j-to-slf4j</artifactId>
                        <groupId>org.apache.logging.log4j</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
    

      

    最终只剩:

    成功解救 

  • 相关阅读:
    将Word,PDF文档转化为图片
    图像识别
    ckeditor_4.5.10_full,ckfinder_aspnet_2.6.2,插件使用
    检索COML类工厂中 CLSID为 {00024500-0000-0000-C000-000000000046}的组件时失败,原因是出现以下错误: 80070005" 《终结篇》
    wireshark抓包图解 TCP三次握手/四次挥手详解
    经常开发出现bug的同事,
    简单理解Socket
    eclipse下如何配置tomcat
    Windows 7系统安装MySQL5.5.21图解
    Tomcat7.0.22在Windows下详细配置过程
  • 原文地址:https://www.cnblogs.com/kingdelee/p/10811575.html
Copyright © 2011-2022 走看看