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

  • 相关阅读:
    Swift 网络请求数据与解析
    第三方-Swift2.0后Alamofire的使用方法
    java异常处理机制throws
    eclipse导入不到嵌套的项目
    java异常处理机制Exception
    在eclipse中查找指定文件
    mysql查询count
    【待解决】An internal error occurred during: "Launching baiduTest1". java.lang.NullPointerException
    TestNG升级
    eclipse安装TestNG插件
  • 原文地址:https://www.cnblogs.com/kangzi/p/8067122.html
Copyright © 2020-2023  润新知