manash
manash

Reputation: 7106

MessageBodyWriter not found for media type application/json

I'm getting the following error in my logs:

org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo
Grave: MessageBodyWriter not found for media type=application/json, type=class com.sample.MyDTO, genericType=class com.sample.MyDTO.

In general, it is caused by the lack of registered MessageBodyWriter but in my case, I do have the jersey-media-proxy JAR on the classpath (with all its dependencies). If that helps debugging, I confirm that the configure method of the MoxyJsonFeature is called when my web application is deployed.

I precise I'm using Jersey v2.21. My web application is deployed on Tomcat 8.0.26.

Any idea?

Thanks, Mickael

Upvotes: 3

Views: 4029

Answers (1)

Saimon Michelson
Saimon Michelson

Reputation: 41

It took me a while to figure it out, but you let me to the solution. It appears that for Moxy to work you need use a:

  1. Default constructor
  2. Setter methods

for every resource

Upvotes: 4

Related Questions