users@jersey.java.net

Re: [Jersey] ClientHandlerException: A message body writer for Java type, class com.sun.jersey.multipart.MultiPart, and MIME media type, application/octet-stream, was not found

From: Craig McClanahan <Craig.McClanahan_at_Sun.COM>
Date: Thu, 11 Dec 2008 23:24:31 -0800

Craig McClanahan wrote:
> The first observation I have is that you *should* really be setting a
> media type on the body part (there is no default in BodyPart itself).
Upon further examination, there actually is a default ("text/plain")
media type for body parts. But there is nowhere in the jersey-multipart
code that the content type of either the MultiPart instance or any
BodyPart instance is ever set to "application/octet-stream" -- in fact,
trying to do this on the MultiPart instance would trigger an exception
-- so I would also spend a few minutes grepping your source code looking
for things that might possibly be related:

    cd <your project home directory>
    grep -i octet `find . -name '*.java'`

It could also be that the default MBW for byte[] entities tries to set
this header itself -- I'll try to look at that possibility tomorrow, but
can't spend more time on it tonight (11:30pm Pacific time right now).

Craig