It turns out that I refactored the following code:
WebResource resource = Client.resource(url);
resource.type(new MediaType("multipart",
"mixed")).post(ClientResponse.class, multipart);
into:
WebResource resource = Client.resource(url);
resource.type(new MediaType("multipart", "mixed"));
resource.post(ClientResponse.class, multipart);
over the past couple of days. It wasn't that clear-cut but (I broke up the
two calls to add an exception-handling block in the middle). The problem is
that I forgot that WebResource.type() returns a Builder object. The code
mistakenly discards the configured resource and issues the post() against
the original Resource object which thinks that multipart is of type
application/octet-stream.
I figured this out by stepping through the unit tests with a debugger until
I noticed where our two code-bases diverged. Sorry for the false alarm.
Thanks for helping me out ;)
Gili
Gili wrote:
>
> I don't remember what I changed in the past two days but all of a sudden I
> am getting this exception:
>
> ClientHandlerException: A message body writer for Java type, class
> com.sun.jersey.multipart.MultiPart, and MIME media type,
> application/octet-stream, was not found
>
> when invoking WebResource.post(ClientResponse.class, multipart). This
> should be working, right?
>
> Gili
>
--
View this message in context: http://n2.nabble.com/ClientHandlerException%3A-A-message-body-writer-for-Java-type%2C-class-com.sun.jersey.multipart.MultiPart%2C-and-MIME-media-type%2C-application-octet-stream%2C-was-not-found-tp1646521p1655492.html
Sent from the Jersey mailing list archive at Nabble.com.