java - Jersey REST error, MessageBodyWriter not found for media type=application/json -


I did not find the messaging recorder when I called for a web service call.

I have included genson-1.1.jar in my square path, which I believe is to include messaging implementation, I still get this error < P> I am using Jersey 2.13.

I have also tried without registering "GensonJsonConverter.class" and still gives the same error

  protected zero doPost (HttpServletRequest request, HttpServletResponse resp) ServletException, IOException {ClientConfig config = new ClientConfig () throws; WebText target = client.target ("http: // localhost: 8080 / web services / comfort / hello"); Target.path ("Lion King"); Target.register (GensonJsonConverter.class); String response = target. request (). Accept (MediaType.APPLICATION_JSON) .get (String.class); Resp.getWriter () print (feedback). } @Path ("Hello") Public class greetings {@GET @Produces (MediaType.APPLICATION_JSON) public book getThisBook (@PathParam ("bookName") string bookName) {Return new book (bookName, "MSN", New Date) ); }}   

web.xml

    

Part of stack trace:

  Critical: MessageBodyWriter did not get to media type = application / json, type = class com.webservices.entity.book , Generic type = class com.webservices.entity.Book servlet.service () [myServlet] for reference with path [/ WebServices] in the context with reference javax.ws.rs.InternalServerErrorException threw: October 10, 2014 15:19 : 49 org.apache.catalina.core.StandardWrapperValve Great Call: HTTP 500 Internal Server Error   

 my elevator folder

1) Metanoff-Services Add Dependency to

OR

2) Register it programmatically.

Edit As you do not create all such as

there is an explanation in more detail with advice. For the Container Program you will find it easy to use the Metannoff-Services solution.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -