【问题标题】:RuntimeException: MessageBodyReader implementation was not found for BufferedInMultiPart in JAX RSRuntimeException:在 JAX RS 中找不到 BufferedInMultiPart 的 MessageBodyReader 实现
【发布时间】:2012-07-18 16:31:47
【问题描述】:
我在尝试进行多部分的 JAX RS 调用时收到以下 RuntimeException。
java.lang.RuntimeException:找不到类 org.a 的 javax.ws.rs.ext.MessageBodyReader 实现
pache.wink.common.model.multipart.BufferedInMultiPart 类型和 text/html;charset=utf-8 媒体类型。验证 t
所有实体提供者均已正确注册。添加自定义 javax.ws.rs.ext.MessageBodyReader 提供程序
如果当前不存在 JAX-RS 实体提供程序,则处理类型和媒体类型。
在 org.apache.wink.client.internal.handlers.ClientResponseImpl.readEntity(ClientResponseImpl.java:12
2)
在 org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:65)
在 org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:52)
谁能帮我弄清楚异常的原因是什么。它只是偶尔发生。
【问题讨论】:
标签:
rest
jax-rs
apache-wink
【解决方案1】:
它清楚地表明您没有注册多部分提供程序。你注册了吗?尝试将记录器置于调试模式,Wink 将打印所有已注册的提供程序。
【解决方案2】:
我有一个非常相似的错误:
org.apache.wink.client.ClientRuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: A javax.ws.rs.ext.MessageBodyWriter implementation was not found for the class com.ibm.json.java.JSONObject type and application/json media type. Verify that all entity providers are correctly registered. Add a custom javax.ws.rs.ext.MessageBodyWriter provider to handle the type and media type if a JAX-RS entity provider does not currently exist.
at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:240) ~[wink-client-1.4.jar:1.4]
at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:189) ~[wink-client-1.4.jar:1.4]
at org.apache.wink.client.internal.ResourceImpl.post(ResourceImpl.java:314) ~[wink-client-1.4.jar:1.4]
经过大量搜索,我们发现我的 WebSphere 8.5.5 安装中缺少的 jar 是:
/opt/WebSphere/AppServer855/runtimes/com.ibm.jaxrs.thinclient_8.5.0.jar
这个 jar 可以添加到我的构建过程中以完成成功运行,无一例外:
/opt/WebSphere/AppServer855/plugins/com.ibm.ws.prereq.jaxrs.jar