You can use jersey json library:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.22</version>
</dependency>
Or genson:
<dependency>
<groupId>com.owlike</groupId>
<artifactId>genson</artifactId>
<version>1.3</version>
</dependency>
Sorry to resurrect this post, but I was having this problem with a Maven project and found that I needed to include a dependency for jackson-jaxrs-json-provider
in my pom:
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.4.1</version>
</dependency>
MVN Repository: http://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider
Your entity class does not have an empty constructor, which is needed for the JAX-RS unmarshalling.
Have a look here:
https://blogs.oracle.com/groundside/entry/jax_rs_2_0_messagebodyreader
Check if you are registering the media type for JSON support. Do you have jersey-media-moxy on your class-path? If not, add this dependency to your pom.xml, please check your jersey version, in this example I'm using Jersey 2 (2.24)
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.24</version>
</dependency>
For Gradle, add the following dependency:
compile group: 'org.glassfish.jersey.media',
name : 'jersey-media-moxy',
version : '2.24.1'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With