专栏首页InvQ的专栏spring boot 启动报错Log4j2 could not find a logging implementation 解决

spring boot 启动报错Log4j2 could not find a logging implementation 解决

报错日志如下

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
ERROR SpringApplication Application run failed
 java.lang.NoClassDefFoundError: org/springframework/core/ErrorCoded
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    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)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    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)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    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)
    at org.springframework.boot.context.properties.bind.BindConverter$TypeConverterConversionService.createTypeConverter(BindConverter.java:182)
    at org.springframework.boot.context.properties.bind.BindConverter$TypeConverterConversionService.<init>(BindConverter.java:176)
    at org.springframework.boot.context.properties.bind.BindConverter.getConversionServices(BindConverter.java:73)
    at org.springframework.boot.context.properties.bind.BindConverter.<init>(BindConverter.java:64)
    at org.springframework.boot.context.properties.bind.Binder$Context.<init>(Binder.java:399)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:209)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:166)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$asDocuments$8(ConfigFileApplicationListener.java:561)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Collections$2.tryAdvance(Collections.java:4717)
    at java.util.Collections$2.forEachRemaining(Collections.java:4725)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.asDocuments(ConfigFileApplicationListener.java:565)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:546)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:515)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:494)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:462)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$4(ConfigFileApplicationListener.java:444)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$5(ConfigFileApplicationListener.java:443)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:440)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:331)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:213)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:196)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:183)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:169)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
    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.environmentPrepared(EventPublishingRunListener.java:74)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:358)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
    at Controller.Application.main(Application.java:23)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.ErrorCoded

maven 加依赖

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.10.0</version>
</dependency>

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • spring boot 启动 NoClassDefFoundError: org/springframework/core/ErrorCoded 报错

    MickyInvQ
  • 常用的类,包,接口,各5个

    MickyInvQ
  • The consumer group[PushConsumer] has been created before, specify another name please

    MickyInvQ
  • spring boot 启动 NoClassDefFoundError: org/springframework/core/ErrorCoded 报错

    MickyInvQ
  • 为什么java越来越强势

    ? 目前很多的从业都有这种感觉,突然觉得c/c++就业机会以及升职的空间比java的差距越来越大了,有人就宣称java是目前国内就业最好的语言,说的有点夸张但...

    Java帮帮
  • java(一)基础知识

    绝命生
  • 「大学生学编程系列」如何学习java?

    java目前在编程语言排行中还是稳稳的第一名,生态链系统越来越稳健,java语言已经慢慢步入成熟期,随之带来的是就业门槛的提升,这也是编程发展的一个趋势,未来编...

    程序员互动联盟
  • SpringBoot开发案例从0到1构建分布式秒杀系统

    最近,被推送了不少秒杀架构的文章,忙里偷闲自己也总结了一下互联网平台秒杀架构设计,当然也借鉴了不少同学的思路。俗话说,脱离案例讲架构都是耍流氓,最终使用Spri...

    小柒2012
  • 线上服务 CPU 又 100% 啦?一键定位 so easy!

    来源:my.oschina.net/leejun2005/blog/1524687

    芋道源码
  • java9导出运行springboot的精简版jre

    为了分发一个springboot项目,在不考虑目标机器是否有jre的情况下,携带一个jre环境是一个选择。本文就尝试从原生的jdk 9.0.1 精简一个jre供...

    pollyduan

扫码关注云+社区

领取腾讯云代金券