Search code examples
javaspringspring-bootnoclassdeffounderror

Spring Boot application which previously worked now gives NoClassDefFoundError


I'm trying to run my Spring Boot application but get this error

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
    at com.greglturnquist.learningspringboot2.learningspringboot2.LearningSpringBoot2Application.main(LearningSpringBoot2Application.java:12)
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)
    ... 1 more

The application previously worked but I rebooted my Mac after an update was installed. Everything was saved before the reboot.


Solution

  • I had installed Gradle plugins on STS but noticed that the project looked like a standard Java project in the Project Explorer so I installed the plugin again and now the application runs.