If you’re trying to produce JSON content using JAX-RS (Jersey) and you’re getting this error:
SEVERE: MessageBodyWriter not found for media type=application/json, type=class ..., genericType=class ...
This means that you are missing a JSON library in your classpath. Jackson is one I’m using so adding this to your pom.xml will help:
<dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-json-jackson</artifactId> <version>2.10.1</version> </dependency>
Thank you, thank you, THANK YOU!!! You just saved me lots of time. Been banging my head against the wall with this error in my new jetty/jersey stack and couldn’t figure out why. This did it. Really, awesome post. Did I already say thank you? 🙂
LikeLike
You’re welcome
LikeLike
Thanks a zillion
LikeLike
You’re welcome
LikeLike
Thank you very much. I am a Chinese trainee, and this note helps a lot.
LikeLike
Thank You very much. Perfect Solution for Jersey 2 based JAX-RS 🙂
LikeLike
Thanks!!
LikeLike
Thanks a ton bro. I was struggling for 2 days and finally got solution here 🙂
LikeLike