zoukankan      html  css  js  c++  java
  • Spring-Boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/turbo/TurboFilter

    今天搭建项目的时候启动报错,java.lang.NoClassDefFoundError: ch/qos/logback/classic/turbo/TurboFilter

    具体错误如下:

    2018-09-15 16:06:14,588 main ERROR appender Console has no parameter that matches element PatternLayout
    Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/classic/turbo/TurboFilter
    	at java.lang.Class.getDeclaredConstructors0(Native Method)
    	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    	at java.lang.Class.getConstructor0(Class.java:3075)
    	at java.lang.Class.getConstructor(Class.java:1825)
    	at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:169)
    	at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:160)
    	at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:229)
    	at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:209)
    	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:122)
    	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:292)
    	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    	at cn.xlink.App.main(App.java:26)
    Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.turbo.TurboFilter
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	... 17 more

    百度到的大部分是缺少包,比如解决办法引入jar包,但是我启动还是报错,那我就继续百度。

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.3</version>
    </dependency>

    其中这篇文章给我了启发:https://blog.csdn.net/qq_35981283/article/details/73161921

    我是里面的包冲突,当然按照里面的办法我也能解决,但是略有不同。

    看我的pom文件

       1、这是最开始的配置,启动不不错,但是无现在不用mongodb了,我就删掉了A但是启动就报错
       A     <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-mongodb</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
        B    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
    后来改成如下这样就不报错了。
    
           <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                 <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    所以是包冲突的问题,改了就好了
  • 相关阅读:
    在linux上安装docker
    【oracle 补丁分类】
    【识记】 域名备案
    【Mysql】Mysql在大型网站的应用架构演变
    【安全】 各大企业的安全服务内容
    【前端知识网站 】 HTML ,CSS 和 Javascript
    【安全】 xss跨站脚本攻击
    【数据库 工具】
    【安全】渗透测试书单与工具
    【渗透测试 在线资源】
  • 原文地址:https://www.cnblogs.com/timeout/p/10145631.html
Copyright © 2011-2022 走看看