Spring Boot Error: Java.Lang.Noclassdeffounderror: Org/Springframework/Util/Assert

Spring Boot Error: java.lang.NoClassDefFoundError: org/springframework/util/Assert

It is better to follow software principles while you are learning and making projects. Try to make project in a way that separation of concern is always achieved, that will make your code not just easy to understand, but to debug and fix too.

Change your application class like this:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

Now make another package controller and make class in it for your testing

@RestController
//You can add this if you want or remove this class level mapping
@RequestMapping("/testApp")
public class TestController {

@RequestMapping("/")
public String home() {
return "Hello World";
}
}

For further help. please check this (official spring.io tutorial) simple example of Spring Boot App in STS.
And another one is this very simple and straightforward to get Spring Boot App up and running.

Edit: please add starter test in pom.xml as well.

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.10.RELEASE</version>
<scope>test</scope>
</dependency>

How to fix the error 'java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedPropertyResolver' in a spring-boot application?

This is because of using the spring-boot-starter-parent version as 2.x but trying to use the older versision 1.5.x for a related dependency, say spring-boot-autoconfigure.

The code below will cause this error because the dependency version is not matching from that of the parent.

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>1.5.13.RELEASE</version>
</dependency>
</dependencies>


Related Topics



Leave a reply



Submit