Jersey client exception: A message body writer was not found

前端 未结 6 1073
说谎
说谎 2020-12-03 15:55

I am using Jersey client to hit a PHP web service for image uploading functionality. I am getting the following exception:

Caused by: com.sun.jersey.api.clie         


        
6条回答
  •  借酒劲吻你
    2020-12-03 16:41

    Jersey (server or client) has providers that support the conversion of a Java type to a stream and vice versa. Your code returns (or receives) a Java object and based on the type of the object and the content type you are using, Jersey looks for an appropriate provider to do the marshalling (or unmarshalling).

    The providers implement the MessageBodyReader or MessageBodyWriter interfaces and for every Java type and content type combination your application uses you must have a provider that knows how to handle the combination.

    The messages you are getting is telling you that Jersey can't find a provider that knows how to marshal a FormDataMultiPart object with a multipart/form-data mime type. You need to provide one, and if I'm not mistaken the default implementation is found in the jersey-multipart.jar and mimepull.jar files.

提交回复
热议问题