zoukankan      html  css  js  c++  java
  • IDEA创建springboot异常(Failed to load class "org.slf4j.impl.StaticLoggerBinder")

    IDEA中创建springboot项目遇到的问题

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.<clinit>(LogbackLoggingSystem.java:66)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:170)
        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.SpringApplication.run(SpringApplication.java:1118)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
        at com.janko.springbootdemo.SpringbootdemoApplication.main(SpringbootdemoApplication.java:10)
    Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.Level
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 19 more

       百度“Failed to load class "org.slf4j.impl.StaticLoggerBinder"

    ”这个,经查是由于在自己的电脑log4j跟项目的idea项目版本不匹配。需要修改pom文件即可

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

    添加exclusions这个模块的内容就可以完成

  • 相关阅读:
    多项式 ln exp
    动态点分治复习
    生成函数与多项式基础
    长链剖分学习笔记
    半平面交复习
    Maven的SSM框架配置文件:
    Linux(CentOs)之安装Redis及注意事项
    Scala:scala的一些简单操作命令
    Maven:如何在eclipse里新建一个Maven的java项目和web项目
    Maven:Eclipse上Maven的配置
  • 原文地址:https://www.cnblogs.com/kangzi/p/8067122.html
Copyright © 2011-2022 走看看