The Short Version:
I am using Jersey 1.17 and Jackson 2.1.4, but Jersey is ignoring every single Jackson-annotation that I use. Why!? Has anybody encountered the same problem?
The Long Version:
I have a RESTful Web Service that was using Jersey 1.17 and Jackson 1.9.2 and I was using the @JsonManagedReference and @JsonBackReference annotations to solve the problem with bidirectional relationships and everything was working fine.
The other day I saw the 2.1.4 version of Jackson that included the @JsonIdentityInfo annotation which seemed like a great solution for my problems so I changed the jar files to Jackson 2.1.4. However, the promising @JsonIdentityInfo annotation was not working and Jersey was ignoring it completely, and after a bit of debugging and changing the code, I found out that even the previous @JsonManagedReference and @JsonBackReference annotations are being ignored by Jersey. So it seems that Jersey is completely ignoring the Jackson 2.1.4 annotations. Why!? Has anybody encountered the same problem?
In my case jackson annotations were ignored because of proguard
As stated in http://wiki.fasterxml.com/JacksonAnnotations:
So could be an "import-related" problem. Another reason (as already stated by @HiJon89) is to use the right JacksonJsonProvider version. For version 2.x it's automatically registered while inserting the "jackson-jaxrs-json-provider" combined with "jersey-core".
My currently working update to jackson 2.1.4 (from a 1.9.2 jersey required dependency) was:
add jersey-core and jackson-jaxrs-json-provider
The latter jar has a file "META-INF/services/javax.ws.rs.ext.MessageBodyWriter" that tell jersey what class act as a provider.
So I've no other advise than to double-check that you don't have the old jars anymore in your classpath.