项目

一般

简介

2.X版本启动报org/springframework/boot/loader/jar/JarFile的问题

由 黄 俊睿 在 超过 2 年 之前添加

异常信息:

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/loader/jar/JarFile
    at com.apusic.springframework.boot.listener.UnpackApplicationListener.onApplicationEvent(UnpackApplicationListener.java:83)
    at com.apusic.springframework.boot.listener.UnpackApplicationListener.onApplicationEvent(UnpackApplicationListener.java:21)
    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:127)
    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:302)
    at chen.yonghui.SpirngBootDemoApplication.main(SpirngBootDemoApplication.java:17)

Process finished with exit code 1

版本号:2.X

解决时间:2022-5-18

解决方案:

在启动包的pom.xml文件中加入

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-loader</artifactId>
</dependency>

界面现象:

日志截图:

解决操作: