Skip to content

Spring Boot 3 – java.lang.ClassNotFoundException:

Error –

Caused by: java.lang.NoClassDefFoundError: org/junit/jupiter/api/io/CleanupMode
at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(
… 13 more
Caused by: java.lang.ClassNotFoundException:
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
at java.base/java.lang.ClassLoader.loadClass(
… 15 more

Environment –

  • Spring Boot version 3 and above
  • Java version 17 and above
  • Junit 5

Root cause –

You may encounter this issue after upgrading from Spring Boot 2 to Spring Boot 3 with Junit 5. It is happening because any other library in your application is actually bringing an older version of junit-jupiter-api which is not compatible with latest Spring Boot.

Another possible root cause could be version difference between junit-jupiter-engine dependency and junit-jupiter-api dependency.

Solution –

Check you have below two dependencies in your application’ pom.xml having same version (version must be greater than 5.9.0 so that it is compatible with Spring Boot 3)



Do you have another solution?

The solution provided above is based on the scenario our one of the developers/contributors faced. If you faced the same issue and found any other root cause then please share your solution in the comment section below. We will add the solution in this article.

1 thought on “Spring Boot 3 – java.lang.ClassNotFoundException:”

Leave a Reply

Your email address will not be published. Required fields are marked *