I want to convert a json string containing a date into DateTime of jodaTime using jackson. Unfortunately I get this error
java.lang.NoSuchFieldError: ADJUST_DATES_TO_CONTEXT_TIME_ZONE
The json object looks like this:
{
"add_time": "2017-04-26 14:26:58",
}
I have included joda time and jackson as follows in my pom.xml:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson.version}</version>
</dependency>
jackson version is 2.8.8. I've created my object mapper this way:
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JodaModule());
Does anybody know what the problem might be? I'm stuck on this for a couple of hours now. I also tried do disable the DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE
but it does not help.
NoSuchFieldError results from class structure incompatibility of jackson library side, so you need to check the finally resolved library versions of jackson series.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With