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这个模块的内容就可以完成

  • 相关阅读:
    网站并发量的计算方法
    Kubernetes-1.16部署之一 ETCD+K8s+Calico
    CentOS 7和Ubuntu 18.04安装Docker
    Tomcat8的kryo序列化方式session共享
    Tomcat启动慢问题解决
    Memcached集群配置
    sed命令使用方法
    python数据分析与算法之五 算法
    python数据分析与算法之四 二叉树和排序二叉树
    python数据分析与算法之三 顺序表和链表
  • 原文地址:https://www.cnblogs.com/kangzi/p/8067122.html
Copyright © 2011-2022 走看看