I have an object with a java.time.LocalDateTime member variable. This object is serialized and deserialized as part of my Camunda process.
But when I run the process, I get a JsonMappingException:
Caused by: spinjar.com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class java.time.LocalDateTime]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
at [Source: N/A; line: -1, column: -1] (through reference chain: my.package.MyObject["myVar"]->myVar["changedDateTime"])
at spinjar.com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
I have gotten around this in other cases (without Camunda) by adding the jackson-datatype-jsr310 dependency and doing the following:
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
However with spinjar it seems like the spinjar ObjectMapper cannot register the JavaTimeModule.
I found this link that mentioned dataformatting https://github.com/camunda/camunda-bpm-examples/tree/master/spin/dataformat-configuration-global but it seems like doing a lot of work for something that should be pretty simple.
Does anyone have any solutions for this? It feels yucky to change my LocalDateTime variable to a String just to keep Camunda happy