简体   繁体   English

找不到媒体类型application / json的MessageBodyWriter

[英]MessageBodyWriter not found for media type application/json

I'm getting the following error in my logs: 我的日志中出现以下错误:

org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo
Grave: MessageBodyWriter not found for media type=application/json, type=class com.sample.MyDTO, genericType=class com.sample.MyDTO.

In general, it is caused by the lack of registered MessageBodyWriter but in my case, I do have the jersey-media-proxy JAR on the classpath (with all its dependencies). 一般来说,它是由缺少已注册的MessageBodyWriter引起的,但在我的情况下,我确实在类路径上有jersey-media-proxy JAR(包含所有依赖项)。 If that helps debugging, I confirm that the configure method of the MoxyJsonFeature is called when my web application is deployed. 如果这有助于调试,我确认在部署Web应用程序时调用MoxyJsonFeature的configure方法。

I precise I'm using Jersey v2.21. 我确切地说我正在使用Jersey v2.21。 My web application is deployed on Tomcat 8.0.26. 我的Web应用程序部署在Tomcat 8.0.26上。

Any idea? 任何的想法?

Thanks, Mickael 谢谢,Mickael

It took me a while to figure it out, but you let me to the solution. 我花了一段时间才弄明白,但你让我解决了问题。 It appears that for Moxy to work you need use a: 看来,要使Moxy工作,您需要使用:

  1. Default constructor 默认构造函数
  2. Setter methods 二传手术方法

for every resource 对于每一种资源

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未找到 Media type=application/json 的 MessageBodyWriter - MessageBodyWriter not found for media type=application/json 找不到媒体类型= application / json的MessageBodyWriter - Getting MessageBodyWriter not found for media type=application/json 未找到媒体类型 = 应用程序/json 的 MessageBodyWriter - MessageBodyWriter not found for media type=application/json 找不到媒体类型= Application / json,glassfish的MessageBodyWriter - MessageBodyWriter not found for media type=Application/json, glassfish 找不到针对媒体类型= application / json的错误MessageBodyWriter - Getting Error MessageBodyWriter not found for media type=application/json 找不到针对媒体类型= application / json的杰克逊网络服务错误MessageBodyWriter - jackson web service error MessageBodyWriter not found for media type=application/json 泽西与Grizzly:找不到媒体类型= application / json的MessageBodyWriter - Jersey with Grizzly: Getting MessageBodyWriter not found for media type=application/json 泽西(Jersey)REST错误,找不到媒体类型= application / json的MessageBodyWriter - Jersey REST error, MessageBodyWriter not found for media type=application/json 找不到具有@xmlrootelement的DTO的媒体类型= application / json的MessageBodyWriter - MessageBodyWriter not found for media type=application/json for DTO with @xmlrootelement 严重:找不到媒体类型 = 应用程序/json;字符集 = utf-8 的 MessageBodyWriter - SEVERE: MessageBodyWriter not found for media type=application/json;charset=utf-8
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM