users@jersey.java.net

[Jersey] Re: Beware of JacksonFeature in Jersey

From: cowwoc <cowwoc_at_bbs.darktech.org>
Date: Sat, 14 Dec 2013 00:07:39 -0500

+1 The documentation needs to get fixed. I got tripped up on this
problem as well, and I'm sure many others as well.

Robert, please file a bug report and send us the link on the mailing list.

Gili

On 13/12/2013 10:03 PM, Robert DiFalco wrote:
> Just a heads up so that people don't have to deal with the craziness I
> just went through.
>
> Setting up Jersey 2.4.1 to work with Jackson is exceedingly simple,
> that is unless you read the Jersey tutorials and documentation.
>
> The JacksonFeature will pull in Jackson 1.9! I don't really think
> anyone uses this version anymore, most of us use fasterxml 2.x.
>
> Just do this:
>
> public class RestApplication extends ResourceConfig {
> public RestApplication() {
> packages( "com.myapp.rest", "com.fasterxml.jackson.jaxrs.base" );
> }
> }
>
> Then add this to your pom.xml:
>
> <dependency>
> <groupId>com.fasterxml.jackson.core</groupId>
> <artifactId>jackson-databind</artifactId>
> <version>${jackson.version}</version>
> </dependency>
> <dependency>
> <groupId>com.fasterxml.jackson.jaxrs</groupId>
> <artifactId>jackson-jaxrs-json-provider</artifactId>
> <version>${jackson.version}</version>
> </dependency>
>
> Completely forget about JacksonFeature AND DO NOT PUT THIS IN YOUR
> pom.xml:
>
> <dependency>
> <groupId>org.glassfish.jersey.media</groupId>
> <artifactId>jersey-media-json-jackson</artifactId>
> <version>${jersey.version}</version>
> </dependency>
>
> It's super simple, everyone seems to make it complicated. Now, listen,
> this is trial and error so maybe there is a reason for all of the
> complexity that the Jersey docs suggest for Jackson or all the blogs
> and stack overflow answers. But Just the two jackson pom entries and
> the fasterxml provider path is all I needed to use Jackson 2.3.0.
>
>
>
>