MessageBodyWriter not found for media type=application/json

org.glassfish.jersey.message.internal.WriterInterceptorExecutor: MessageBodyWriter not found for media type=application/json, type=class xxxxx

搜索了解决方式两三天,网上的方案都不能解决,后来在不断浏览帖子时,看到这个帖子:
https://stackoverflow.com/questions/26207252/messagebodywriter-not-found-for-media-type-application-json/33756603#33756603
的其中一个评论:
MessageBodyWriter not found for media type=application/json_第1张图片
即先调用Gson().toJson(); 把对象转换成jsonString,然后使用这个jsonString即可,这样就不用给jersey框架转递实体类的对象了,传递的是一个字符串。

参考:
Jersey: MessageBodyWriter not found for media type=application/json, type=class org.codehaus.jackson.node.ObjectNode?

getting SEVERE: MessageBodyWriter not found for media type=application/json, type=class org.json.JSONObject

解决jersey客户端org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=multipart/form-data, type=class org.glassfish.jersey.media.multipart.FormDataMultiPart, genericType=class org.glassfish.jersey.media.multipart.FormDataMultiPart.

MessageBodyWriter not found for media type=application/json

MessageBodyWriter not found for media type application/json when using MOXy #3235

how to send json object from REST client using javax.ws.rs.client.WebTarget

Jersey 与springMVC集成无法输出XML格式 报 MessageBodyWriter not found for media type=application/xml的解决办法

用Jersey构建RESTful服务-JAVA对象转成XML/Json输出

你可能感兴趣的:(后端,json)