RuntimeException:在JAX RS中找不到BufferedInMultiPart的MessageBodyReader实现

时间:2012-07-18 16:31:48

标签: rest jax-rs apache-wink

在尝试进行多部分的JAX RS调用时,我得到以下RuntimeException。

java.lang.RuntimeException:找不到类org.a的javax.ws.rs.ext.MessageBodyReader实现 pache.wink.common.model.multipart.BufferedInMultiPart type和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)         at org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:65)         在org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:52)

任何人都可以帮我弄清楚异常的原因是什么。它偶尔会发生。

2 个答案:

答案 0 :(得分:1)

它清楚地表明您没有注册多部分提供商。你注册了吗?尝试将记录器置于调试模式,Wink将打印所有已注册的提供者。

答案 1 :(得分:0)

我有一个非常类似的错误:

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
相关问题