[英]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工作,您需要使用:
for every resource 对于每一种资源
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.