1

I am trying to set the current date in my domain class with this code

private LocalDate createdUTC = LocalDate.now(Clock.systemUTC());

I do not have any setter for this property only getter. When I send a request through RestTemplate to my controller I get this error

{ "responseCode": 500, "responseText": "Could not read document: Can not construct instance of java.time.LocalDateTime: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)\n at [Source: java.io.PushbackInputStream@6bde8de2; line: 1, column: 352] (through reference OrganizationResponse[\"createdUTC\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.time.LocalDateTime: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)\n at [Source: java.io.PushbackInputStream@6bde8de2; line: 1, column: 352] (through reference chain: OrganizationResponse[\"createdUTC\"])" }

What I have tried so far are solutions from this and this

reachinout
  • 13
  • 6
  • 1
    Have you tried this:https://stackoverflow.com/questions/27952472/serialize-deserialize-java-8-java-time-with-jackson-json-mapper – soorapadman May 29 '17 at 11:57
  • 1
    I have added this `@EntityScan( basePackageClasses = {Application.class, Jsr310JpaConverters.class} )` in my main class. Still it throws the same error. – reachinout May 29 '17 at 12:08

0 Answers0