Camunda Spin @JsonIgnoreProperty Annotation doesnt work

Hello fellas,
I have a problem with the jackson annotation @JsonIgnoreProperty.
I tried it with the ObjectMapper and it works really fine, but then i found out about Camunda Spin.
Now i wanted to try the same but a exception is called because of the missing Attribute “meta”.
Has anyone had this problem as well?
If can you help me find another option to ignore the missing attribute.

Blockquote
Exception in thread “main” org.camunda.spin.json.SpinJsonException: SPIN/JACKSON-JSON-01006 Cannot deserialize ‘{“meta”:{"…’ to java type ‘[simple type, class at.gw.camunda.bpmn.wim.UserBody]’
at org.camunda.spin.impl.json.jackson.JacksonJsonLogger.unableToDeserialize(JacksonJsonLogger.java:65)
at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper.mapInternalToJava(JacksonJsonDataFormatMapper.java:76)
at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper.mapInternalToJava(JacksonJsonDataFormatMapper.java:60)
at org.camunda.spin.impl.json.jackson.JacksonJsonNode.mapTo(JacksonJsonNode.java:468)
at at.gw.camunda.bpmn.wim.WimUserGetter.getUserListSpin(WimUserGetter.java:102)
at at.gw.camunda.bpmn.wim.WimUserGetter.main(WimUserGetter.java:111)
Caused by: spinjar.com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field “meta” (class at.gw.camunda.bpmn.wim.UserBody), not marked as ignorable (6 known properties: “schemas”, “userName”, “emails”, “additionalProperties”, “name”, “password”])
at [Source: N/A; line: -1, column: -1] (through reference chain: at.gw.camunda.bpmn.wim.UserBody[“meta”])
at spinjar.com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51)
at spinjar.com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:839)
at spinjar.com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1045)
at spinjar.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1352)
at spinjar.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1330)
at spinjar.com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:264)
at spinjar.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
at spinjar.com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3708)
at spinjar.com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2071)
at org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper.mapInternalToJava(JacksonJsonDataFormatMapper.java:74)
… 4 more

Hi @msi09,

I guess you use Camunda’s Tomcat distribution, right?

Whenever you use the Spin artifact camunda-spin-dataformat-all, you work with an embedded version of Jackson that is relocated to a different package space. That way, Camunda does not pollute the classpath with a certain jackson verison. That’s also way we can find lines like spinjar.com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty in the stacktrace (note the package name).

However, this also means that the relocated Jackson version won’t consider Jackson annotations of the original Jackson namespace. In order to make that work, you have to replace the camunda-spin-dataformat-all artifact by the artifacts (and their transitive dependencies) that are listed here: https://docs.camunda.org/manual/7.9/user-guide/data-formats/configuring-spin-integration/#camunda-spin-core.

Cheers,
Thorben

2 Likes

Worked fine Thanks!

I have the same issue, and I don’t quite understand this part. I am using the bom for SPIN, do I need to remove it and replace it with the individual dependencies, sans the dataformat-all?