Spring Saving Data 2.4. Intermittent error (ClassCastException)

Working with Spring Data retention continues. Switching to 2.4.0 has given me more of the behavior I want, however now I get a weird intermittent exception.

A., 2/3 of the time when I restart or deploy my application, each data SDR endpoint throws 500 and gives the following:

GET /api/departments -------------------- HTTP Status 500 - Could not write content: org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$ProjectionResourceContentSerializer cannot be cast to com.fasterxml.jackson.databind.ser.impl.UnwrappingBeanSerializer (through reference chain: org.springframework.hateoas.PagedResources["_embedded"] ->java.util.UnmodifiableMap["departments"] ->java.util.ArrayList[0] ->org.springframework.data.rest.webmvc.json.ProjectionResource["content"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$ProjectionResourceContentSerializer cannot be cast to com.fasterxml.jackson.databind.ser.impl.UnwrappingBeanSerializer (through reference chain: org.springframework.hateoas.PagedResources["_embedded"] ->java.util.UnmodifiableMap["departments"] ->java.util.ArrayList[0] ->org.springframework.data.rest.webmvc.json.ProjectionResource["content"]) 

(Full error report available: http://pastebin.com/xzzXkFiR )

As I said, this does not happen every time I restart / deploy the application, but if it does, it completely gets stuck and rebooting is the only way to fix it. Very weird behavior, wondering if anyone has an understanding.

The problem does not occur if I return to Spring Data Rest 2.3.2

Thanks for the help, and please let me know what other relevant information I can provide.

  • SDR: 2.4.1
  • SFW: 4.2.1
  • SDJPA: 1.9.0
Some additional tests

The problem also arises with the latest (2.5.0 SNAPSHOT).

+6
source share
2 answers

Errors in the jackson-databind library. Upgrade to free the Gosling-SR3 train after its release.

See https://jira.spring.io/browse/DATAREST-716 and https://jira.spring.io/browse/DATAREST-743

+2
source

I can observe the same problem after upgrading to Spring Data Rest 2.4.0. The problem is not deterministically reproducible. So far I have no statistics, but it is less common after updating Jackson's dependencies from 2.4.0 to 2.6.0. Sometimes it pops up, but in my case a reboot is enough. A minimal example will help you dive deeper into it.

+6
source

All Articles