I'm totally alien to Jersey. I'm trying to run a jar which throws javax.ws.rs.WebApplicationException
when I hit the endpoint. The error thrown by the program is as follows:
09-Apr-2011 08:32:20 com.sun.jersey.spi.container.ContainerResponse write
SEVERE: A message body writer for Java class java.lang.String, and Java type class java.lang.String, and MIME media type application/json was not found
09-Apr-2011 08:32:20 com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are: / -> com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
09-Apr-2011 08:32:20 com.sun.jersey.spi.container.ContainerResponse logExcept开发者_如何学JAVAion
Any ideas for where to start looking at for debugging?
Update: I've got javax.ws.rs.ext.MessageBodyWriter
in the META-INF/services
of the jar with the following content: com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
And at the beginning of the program I see: com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
You need to include jersey-json module on your class path - see the Jersey dependencies page, which has a list of dependencies you need to include based on the type of functionality you need: http://jersey.java.net/nonav/documentation/latest/chapter_deps.html
精彩评论