SEVERE: MessageBodyWriter not found for media type=application/json, type=class com.jersey.jaxb.Todo, genericType=class com.jersey.jaxb.Todo

You have jackson-jaxrs-json-provider which is a start..

But...

that artifact is still dependent on Jacskon itself, which includes all these artifacts

enter image description here

That's why we use Maven[1] (so we don't have to worry about this kind of thing :-). So go find these.

Then just add the package to the web.xml, and it should work

<param-name>jersey.config.server.provider.packages</param-name>
<param-value>
    com.jersey.jaxb,
    com.fasterxml.jackson.jaxrs.json
</param-value>

1. Maven dependency

<dependency>
  <groupId>com.fasterxml.jackson.jaxrs</groupId>
  <artifactId>jackson-jaxrs-json-provider</artifactId>
  <version>2.2.3</version>
</dependency>

Or use the below Jersey "wrapper" for the above dependency. It will register the Jackson providers (so we don't need to explicitly register like above), and the Jackson exception mappers, and start from version 2.17, provides support for Entity Data Filtering.

<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>${jersey2.version}</version>
</dependency>

Note: The fact that we don't have to register anything with the above dependency, is made possible through the Auto-discovery feature of Jersey. If we for some reason disable the auto-discovery, you will want to explicitly register the JacksonFeature.


The solution may be to make ensure that the model classes have a no-argument constructor.

And add this dependency on your pom.XML:

<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-moxy</artifactId>
</dependency>

I had the same issue, i solved it by addind a empty constructor to the class

public SandBoxClass(){} //-> solved the issue**

public SandBoxClass(Integer arg1, Integer arg2) {
        this.arg1=arg1;
        this.arg2=arg2;
}

If you already have the jersey-media-moxy dependency added into your pom.xml. Make sure your entity class has the default constructor. I got this issue when I introduced a paramatrized constructor in the model class. Adding the default constructor again worked for me.


As for me, it helped to register JacksonFeature:

public class App extends ResourceConfig {
   public App() {
       packages("info.ernestas.simplerest");
       register(new JacksonFeature()); // This magical line helped
   }
}