0

I am using Java 9, Maven and Spring boot 2.0.1 on Eclipse Oxygen.

When I run the application, I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/util/Assert
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:263)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:247)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)

Caused by: java.lang.ClassNotFoundException: org.springframework.util.Assert
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
N. Labrahmi
  • 657
  • 4
  • 23
  • Are you using maven? Check whether the missing class is present in your maven dependencies – tryingToLearn Mar 13 '18 at 08:12
  • I am using maven and the class is there. –  Mar 13 '18 at 08:29
  • Try using the latest version of jar – tryingToLearn Mar 13 '18 at 08:31
  • how are you running your Spring Boot application from Eclipse? – diginoise Mar 13 '18 at 11:42
  • Right click on the project ->run as -> Spring boot app –  Mar 13 '18 at 12:01
  • perhaps open Run Configurations and check whether your Run is properly configured. I take you are using STS plugin. When in doubt, always try `mvn spring-boot:run` from the command line. Also check here for more details: https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-running-your-application.html – diginoise Mar 13 '18 at 12:43
  • Several levels of the tooling may contribute this, as on Java 9 you may need a non-trivial command line to get all you dependencies in the right combination of classpath and modulepath. One approach to analyse this would be by inspecting the command line created by Eclipse: after launching open the Debug View, select the second node and inspect its properties containing the full command line. – Stephan Herrmann Mar 13 '18 at 16:16
  • In case the problem is related to specifics of *test* dependencies, you may want to try a recent milestone build, please see https://www.eclipse.org/eclipse/news/4.8/M5/#jdt-test-sources - when trying, make sure you also have the latest m2e. – Stephan Herrmann Mar 13 '18 at 16:19
  • Thank you all, I updated my Java and maven to latest version.Everything working properly now. –  Apr 19 '18 at 09:26

0 Answers0