@JsonIgnore not working

2,113 views
Skip to first unread message

p.leu...@gmail.com

unread,
Nov 3, 2015, 9:32:03 AM11/3/15
to camunda BPM users
Hi,

we are serializing process variables to JSON using spin, which basically is working.
Now I added a convenience method to our entity, calculating the value from other attributes.
To prevent this method to result in a serialized field, I added a com.fasterxml.jackson.annotation.JsonIgnore annotation.

Problem is, it will not be respected during serialization.

I debugged it into jackson internals and found out jackson did parse the annotation correctly, but is using two distinct instances of JsonIgnore in com.fasterxml.jackson.databind.introspect.AnnotatedWithParams.getAnnotation(Class<A>), i.e. the provided instances != key in _annotations

I have no clue why this is happening. And how to fix it. Can you?

Maybe I should mention, we are running camunda 7.3 on wildfly. All spin artifacts are configured as provided in the pom.

Cheers,
Philipp

thorben....@camunda.com

unread,
Nov 5, 2015, 3:39:25 AM11/5/15
to camunda BPM users, p.leu...@gmail.com
Hi Philipp,

This sounds very much like a classloading problem and that there are two instances of the class JsonIgnore. Spin won't recognize a Jackson annotation that is loaded by a different classloader than the Jackson classes Spin uses.

Is there another Jackson version on your process application's classpath that contains this annotation? I'm not too familiar with wildfly classloading, but it could also be that wildfly provides your application with a different class loader for the jackson module than it provides the Spin dataformat module with. Perhaps you can dig in that direction and give some details on your application, dependency, and module structure here.

Cheers,
Thorben
Reply all
Reply to author
Forward
0 new messages