question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jackson deserialization fails (Spring Boot 2.5)

See original GitHub issue

After migrating to Spring Boot 2.5, some of my controller tests failed with the following warning:

RepositoryRestMvcConfiguration$ResourceSupportHttpMessageConverter Failed to evaluate Jackson deserialization for type [[simple type, class org.springframework.data.rest.webmvc.PersistentEntityResource]]: java.lang.NullPointerException: Cannot invoke “org.springframework.data.util.TypeInformation.getActualType()” because “propertyType” is null

As far as I can tell, this only happens to tests where I place an URI reference in payloads, e.g.: http://localhost/entity/foobar. To me it looks like Spring Data Rest can’t resolve the entity thats referenced by the URI. Any ideas what could be the issue?

Test logs

10:58:23.048 [main] WARN RepositoryRestMvcConfiguration$ResourceSupportHttpMessageConverter Failed to evaluate Jackson deserialization for type [[simple type, class org.springframework.data.rest.webmvc.PersistentEntityResource]]: java.lang.NullPointerException: Cannot invoke "org.springframework.data.util.TypeInformation.getActualType()" because "propertyType" is null

MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /follows
       Parameters = {}
          Headers = [Content-Type:"application/hal+json;charset=UTF-8", Content-Length:"66"]
             Body = {"followee":"http://localhost/athletes/paul","status":"REQUESTED"}
    Session Attrs = {}

Handler:
             Type = org.springframework.data.rest.webmvc.RepositoryEntityController
           Method = org.springframework.data.rest.webmvc.RepositoryEntityController#postCollectionResource(RootResourceInformation, PersistentEntityResource, PersistentEntityResourceAssembler, String)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = org.springframework.http.converter.HttpMessageNotReadableException

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 400
    Error message = null
          Headers = [Vary:"Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers", Content-Type:"application/vnd.wdb.problem+json;charset=UTF-8", X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0", X-Frame-Options:"DENY"]
     Content type = application/vnd.wdb.problem+json;charset=UTF-8
             Body = {"status":400,"title":"Bad Request","detail":"Bad Request","instance":"http://localhost/follows","type":"https://developer.mozilla.org/docs/Web/HTTP/Status/400","invalid-params":[]}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []

java.lang.AssertionError: Status expected:<201> but was:<400>
Expected :201
Actual   :400

Possible duplicate of #2015

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
sullrich84commented, Jul 27, 2021

This issue seems to be fixed when updating to Spring Boot 2.5.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jackson module not registered after update from Spring Boot ...
This problem occurs because JSON doesn't natively have a date format, so it represents dates as String. The String representation of a date ......
Read more >
Spring Boot 2.5.0 and InvalidDefinitionException: Java 8 date ...
After update from Spring Boot 2.4.5 to Spring 2.5.0 I noticed the following exceptions in the application logs: Caused by: com.fasterxml.jackson.databind.exc.
Read more >
Jackson Dependency Issue in Spring Boot with Maven Build
This error occurs due to Jackson dependency conflict. We are working on a Spring Boot project and it's inheriting from the Spring Boot...
Read more >
Serialization and Deserialization Issues in Spring REST
Spring Boot projects primarily use the JSON library Jackson to serialize and deserialize objects. It is especially useful that Jackson ...
Read more >
Spring Boot - Customize the Jackson ObjectMapper
When using JSON format, Spring Boot will use an ObjectMapper instance to serialize responses and deserialize requests.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found