I'm trying to upgrade spring boot version to 2.4.2 from 2.1.x, I got ClassNotFoundException: org.springframework.core.metrics.ApplicationStartup. The pom.xml below:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
<relativePath/>
</parent>
The error stack trace below:
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartup
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:251)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:264)
at com.amway.commerce.commodity.Application.main(Application.java:27)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.metrics.ApplicationStartup
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
I don't know if there is someting confict with this version. I wanna get some help, thanks.
Comment From: bclozel
This Spring Boot version depends on Spring Framework 5.3.3 - and this class is present there.
Maybe your spring-core
dependency is corrupted in your local repository? Could try again after purging your local repository with mvn dependency:purge-local-repository
?
Also, please upgrade from one minor version to the next one - the Spring Boot team is providing dedicated wiki pages to help you migrate your applications: you should try upgrading to 2.2, then 2.3 and finally 2.4.
Thanks,
Comment From: silverlight
This Spring Boot version depends on Spring Framework 5.3.3 - and this class is present there.
Maybe your
spring-core
dependency is corrupted in your local repository? Could try again after purging your local repository withmvn dependency:purge-local-repository
?Also, please upgrade from one minor version to the next one - the Spring Boot team is providing dedicated wiki pages to help you migrate your applications: you should try upgrading to 2.2, then 2.3 and finally 2.4.
Thanks,
ok got it,thanks a lot ! :)
Comment From: seqqueman
You can try with adding this dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${version.spring-boot}</version>
</dependency>
With this one a could resolve my problem.