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:
- IDEA-167412 Gradle 3.4-rc-1 changes compile dependencies to provided
- original bug report in the Gradle project with more details
- comment from the responsible developer regarding "Create Module per source set" option and how Gradle integration works in IntelliJ IDEA
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
上一篇: Intellij Idea配置
下一篇: Spring整合junit
推荐阅读
-
IntelliJ Idea SpringBoot 数据库增删改查实例详解
-
IDEA 配置 SpringBoot 启动端口
-
SpringBoot项目在IntelliJ IDEA中实现热部署
-
使用IDEA启动项目遇见ClassNotFoundException的解决方案
-
intellij IDEA配置springboot的图文教程
-
关于idea运行springboot项目总是报找不到报异常的解决办法
-
idea启动项目报错Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
-
Springboot 使用Idea启动web项目访问JSP报404错误解决
-
Intellij IDEA Messages报Information:java: javacTask: 源发行版 8 需要目标发行版 1.8 Information:java: Errors occu
-
IntelliJ IDEA2018**安装 SpringBoot项目