A message body writer for Java class ... and MIME media type text/html was not found [duplicate] A message body writer for Java class ... and MIME media type text/html was not found [duplicate] json json

A message body writer for Java class ... and MIME media type text/html was not found [duplicate]


I had the same issue and it was down to not having Jersey's json module included on my classpath. You can simply fix it by adding the following dependency on maven

<dependency>    <groupId>com.sun.jersey</groupId>    <artifactId>jersey-json</artifactId>    <version>1.14</version></dependency>


It seems that you need to implement the required MessageBodyWriter for the classes which your transport through Jersey.

You can attach @Provider to class A, and make it implements MessageBodyWriter such as:

@Providerpublic class A implements MessageBodyWriter

This will force you to override the required methods(writeTo, getSize, isWriteable) while jersey is tranporting the objects in your methods.