spring-projects / spring-projects/spring-hateoas

Error throws java.lang.NoClassDefFoundError: org/springframework/hateoas/Identifiable

Open
#1,807 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

I updated the spring boot version as 2.7.1 and Hateos as 1.5.1. Jackson-databind as 2.13.3

       `<dependency>
            <groupId>org.springframework.hateoas</groupId>
            <artifactId>spring-hateoas</artifactId>
            <version>1.5.1</version>
       </dependency>

       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <version>2.7.1</version>
       </dependency>

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

After upgrading the version, I am getting java.lang.NoClassDefFoundError: org/springframework/hateoas/Identifiable exception when trying to call objectMapper.readValue method.

objectMapper.readValue(json, aClass);

aClass contains the following properties

private Links links; private Products products;

I think the problem with links properties. When I am trying to map the response with model class getting this error.

I am calling the some of the rest service with MediaType.valueOf("application/hal+json") and map with respective model class.

It worked with previous versions. Can you please guide?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the declared Spring Boot, Spring HATEOAS, and Jackson versions, then trace the objectMapper.readValue(json, aClass) path with a model containing Links and Products. Done means the HAL response can be mapped without the NoClassDefFoundError and the compatible dependency combination is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.