I am getting the following error from my REST interface:
Problem deserializing property 'calculationStartDate' (expected type: [simple type, class java.time.LocalDate]; actual type: org.joda.time.LocalDate)
This is very strange, because I am not using Joda time at all. I am using Java 8 with the Java 8 DateTime API.
Here's a snap of the entity class code in question:
@ApiModelProperty(
value = "De datum waarvoor de berekening moet worden uitgevoerd.",
required = true)
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonSerialize(using = LocalDateSerializer.class)
private LocalDate calculationStartDate;
And here are all the imports for this class:
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.joda.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.time.LocalDate;
import javax.xml.bind.annotation.XmlRootElement;
So why do I get this error in the response body???
I am using WildFly 10, with the original FasterXML (2.5.4) replaced for FasterXML 2.6.3 and coding in plain Java EE 7 with swagger and jackson-datatype-jsr310 added in my pom.xml
:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.6.3</version>
</dependency>