Vinod Sidiginamale
Vinod Sidiginamale

Reputation: 241

Spring 4.3.7 is throwing java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/util/DefaultIndenter

When I am migrating from spring 4.3.4 to 4.3.7 I am facing NoclassDefined error after adding Jackson-core dependency

Caused By: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/util/DefaultIndenter

I tried to add jackson-core

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.5</version>
</dependency>

dependency also but no luck

Any one who can shed some light on this would be appreciated.

Thanks Vinod

Upvotes: 12

Views: 5481

Answers (3)

Dasari Swaroop Kumar
Dasari Swaroop Kumar

Reputation: 169

This worked for me!

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

Upvotes: 0

Aleksandar
Aleksandar

Reputation: 4144

If someone else found this through Google and if You are using Spring Boot, here is what solved the problem for me. Try setting the parent of Your pom file (i.e. Maven project):

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

This will set the spring-boot-starter version to 2.0.2, and not the 1.x, which was default (at least for me).

Following the comment of Chris Nauroth, I've used the mvn dependency:tree and saw that the 1.x version of Spring Boot used the 2.4.x version of Jackson, whereas spring-boot-starter version 2.x uses Jackson 2.5 or higher.

Upvotes: 0

OJVM
OJVM

Reputation: 1481

I had this problem, with Spring 4.3.22.RELEASE and jackson-databind 2.2.3, I only had to upgrade to 2.9.8 and problem solved.

Upvotes: 1

Related Questions