Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: org/springframework/util/unit/DataSize while running spring boot project

Tags:

spring-boot

After chaning the spring-boot version to 2.0.1.RELEASE Getting this error while running spring boot project. I just change version from 2.0.3.RELEASE

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.1.0.RELEASE</version>
    </dependency>

[DEV: 2018-Dec-03 17:35:10,523][ERROR][main      ]Application run failed
java.lang.NoClassDefFoundError: org/springframework/util/unit/DataSize
at org.springframework.boot.convert.StringToDataSizeConverter.getConvertibleTypes(StringToDataSizeConverter.java:40)
at org.springframework.core.convert.support.GenericConversionService$Converters.add(GenericConversionService.java:507)
at org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:105)
at org.springframework.boot.convert.ApplicationConversionService.addApplicationConverters(ApplicationConversionService.java:107)
at org.springframework.boot.convert.ApplicationConversionService.configure(ApplicationConversionService.java:91)
at org.springframework.boot.convert.ApplicationConversionService.<init>(ApplicationConversionService.java:52)
at org.springframework.boot.convert.ApplicationConversionService.<init>(ApplicationConversionService.java:45)
at org.springframework.boot.convert.ApplicationConversionService.getSharedInstance(ApplicationConversionService.java:71)
at org.springframework.boot.SpringApplication.configureEnvironment(SpringApplication.java:486)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:346)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at org.onap.universalvesadapter.Application.main(Application.java:29)
Caused by: java.lang.ClassNotFoundException: org.springframework.util.unit.DataSize
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
like image 228
amshegokar Avatar asked Dec 03 '18 12:12

amshegokar


1 Answers

This issue resolved for me because my POM.xml wrongly had the spring.version in properties tag.

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

<properties>
    <java.version>1.8</java.version>
    <kotlin.version>1.2.71</kotlin.version>
    <!-- <spring.version>5.0.6.RELEASE</spring.version> -->
</properties>
like image 129
jugalmadhavan Avatar answered Oct 07 '22 12:10

jugalmadhavan