1

Im getting the following RuntimeException when trying to make JAX RS call of multipart.

java.lang.RuntimeException: A javax.ws.rs.ext.MessageBodyReader implementation was not found for class org.a pache.wink.common.model.multipart.BufferedInMultiPart type and text/html;charset=utf-8 media type. Verify t hat all entity providers are correctly registered. Add a custom javax.ws.rs.ext.MessageBodyReader provider to handle the type and media type if a JAX-RS entity provider does not currently exist. at org.apache.wink.client.internal.handlers.ClientResponseImpl.readEntity(ClientResponseImpl.java:12 2) at org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:65) at org.apache.wink.client.internal.handlers.ClientResponseImpl.getEntity(ClientResponseImpl.java:52)

Can anyone help me in figuring out what is the cause of the exception. It happens occasionally only.

shaunthomas999
  • 5,544
  • 2
  • 26
  • 30

2 Answers2

1

It clearly says that you didn't register the multipart provider. Did you register it? Try to put logger into debug mode, Wink will print all registered providers.

Tarlog
  • 10,024
  • 2
  • 43
  • 67
1

I had a very similar error:

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]

After a lot of searching we found the missing jar in my WebSphere 8.5.5 install was:

/opt/WebSphere/AppServer855/runtimes/com.ibm.jaxrs.thinclient_8.5.0.jar 

This jar could be added to my build process to accomplish a successful run without the exception:

/opt/WebSphere/AppServer855/plugins/com.ibm.ws.prereq.jaxrs.jar
Larry Ricker
  • 199
  • 1
  • 7