I finally figured out how to do this, thanks to the great support of Tome. So ... there it is!
I'll start by explaining how this can be achieved in the latest version of the Tomee 1.6 JAX-RS , which will be released soon as stable. By the way, he is very stable, even now.
Suppose you have a Maven Java EE 6 web application project (use NetBeans to create it), here are the steps:
1. Add Jackson dependency to pom.xml
<dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-jaxrs</artifactId> <version>1.9.13</version> </dependency>
2. Create openejb-jar.xml in WEB-INF (folder with web.xml) containing:
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1"> <pojo-deployment class-name="jaxrs-application"> <properties> cxf.jaxrs.providers = org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider </properties> </pojo-deployment> </openejb-jar>
For more information about this config, see 1 and 2
Edit from @rmannibucau : if you are using a custom jaxrs Application subclass (for example, with @ApplicationPath), you will set the qualified name of this class instead of "jaxrs-application" (which means the default application).
3. Create a JAX-RS resource that will not work without Jackson (example: regular list):
import java.util.Arrays; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/jackson") public class Resource { @GET @Produces({MediaType.APPLICATION_JSON}) public Object sayHelloJson() { return Arrays.asList(new String[]{"Peter", "pan", "Ihihi"}); } }
4. Deploy JAX-RS on Tomee 1.6.0 and run the application at: http://localhost:8080/yourAppPath/jackson This guide has been tested with version 1.6.0 2013.10.24 on NetBeans 7.4.
If you want to use the latest Jackson, replace the previous dependency as follows:
<dependency> <groupId>com.fasterxml.jackson.jaxrs</groupId> <artifactId>jackson-jaxrs-json-provider</artifactId> <version>2.2.3</version> </dependency>
and change the openjb-jar.xml to contain:
cxf.jaxrs.providers = com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
Tomee 1.5.2
For this version, providers must be specified for each resource, therefore, not at the application level, as in 1.6.0. More information can be found here .