I want to use Jackson as JSON provider for my JAX-RS 2.0 webservice. For JAX-RS I use Jersey 2.0 in GlassFish 4. With JAX-RS 1.x I can add
You should only need to get the implementation jar Jackson JAX-RS provider, add that to your classpath, and it should work. Version 2.x uses SPI-based auto-registration, so that you do not need anything in web.xml
.
The above code worked for me. JAX-RS 2.0 has auto discovery feature so it should detect your jersey-media-json-jackson.jar
. I am using a Tomcat setup so, I had to explicitly call register(JacksonFeature.class)
in my application as you do.