users@jersey.java.net

Re: [Jersey] Upgraded from Jersey 1.1 to 1.4, and JSON now has "null" values throughout

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Thu, 30 Sep 2010 15:05:24 -0700

On Thu, Sep 30, 2010 at 2:27 PM, Tim McCune <tim_at_mccune.name> wrote:
> Hmm...actually, I'm seeing a lot of behavior that I wouldn't expect, and
> it's making me wonder if I'm doing something wrong.  Jersey seems to be
> skipping my JAXB annotations completely.  My @XmlTransient properties are
> showing up in my JSON output, and my @XmlJavaTypeAdapters are not being
> used.
>
> Has Jersey changed its default JSON marshalling to no longer go through
> JAXB?  Or am I doing something wrong?  I haven't changed any code; I simply
> upgraded Jersey from 1.1.4.1 to 1.4.

I could be wrong, but symptoms would fit with using Jackson configured
to only use its own annotations (default), not with JAXB or
Jackson+JAXB annotations.
Jackon JAX-rs package comes with pre-configured alternatives for both;
JacksonJaxbJsonProvider and JacksonJsonProvider.
Maybe Jersey 1.4 uses latter, not former?

As to changes, I don't know for sure but I think that existing json
mappers still work the way they used to, and it's just question of
which mapper is used by default.
For user it is of course a significant change.

-+ Tatu +-