users@jersey.java.net

Entity provider not getting picked up

From: Jaka Jančar <jaka_at_kubje.org>
Date: Mon, 20 Apr 2009 12:07:40 +0200

I have a resource method:
--
@GET
@Produces(MediaType.APPLICATION_JSON)
public Object get() {...}
--
And a custom entity provider:
--
@Provider
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class MyEntityProvider implements MessageBodyReader<Object>,
MessageBodyWriter<Object>
--
But when invoking the method, the entity provider isn't getting called
at all, and I get the exception:
--
Apr 20, 2009 12:06:19 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: A message body writer for Java type, class java.lang.Object,
and MIME media type, application/json, was not found
Apr 20, 2009 12:06:19 PM
com.sun.jersey.server.impl.application.WebApplicationImpl onException
SEVERE: Internal server error
javax.ws.rs.WebApplicationException
	at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:241)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:689)
--
Is there anything else I need to do to register it?