欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Intellij Idea启动springboot报ClassNotFoundException

程序员文章站 2022-06-13 20:36:53
...

Intellij Idea版本为Ultimate 2016.1, gradle版本为3.5,启动springboot报错

java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
    at com.some.fancy.name.Application.main(Application.java:13)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
    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)
    ... 6 more

首先排除了各种因依赖配置错误问题,各种百思不得其解。最后google搜到,原来是个bug。

It's a known issue in IntelliJ IDEA that is specific to Gradle 3.4 and later versions:

It's already fixed in IntelliJ IDEA 2017.1 and 2016.3.6.

You can also use Gradle 3.3 or older as a workaround if you can't or don't want to update IntelliJ IDEA.

原文地址:

https://*.com/questions/42587487/noclassdeffounderror-after-intellij-idea-upgrade/42588061#42588061

 

解决办法,更新Intellij Idea至2016.3或者2017.1,要么使用3.3版本或者低于3.3版本的gradle。 

转载于:https://my.oschina.net/lock0818/blog/1575875