I have registered Jackson as a provider for CXF 3.0, and I can use it to
serialize XML from JAXB beans just fine.  When I try to upload a file to
another external server that consumes multipart, I get the following error:

No message body writer has been found for class [B, ContentType:
application/octet-stream

The relevant code section is here:

Client client = ClientBuilder.newBuilder()
                        
.register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class)
                        .build();
WebTarget target = client.target(targetUrl);
builder = target.request();
builder = builder.accept(headersMap.get(HttpHeaders.ACCEPT));
byte [] theBytes = getBytes(theFile);
Entity<byte[]> entity = Entity.entity(theBytes,
MediaType.APPLICATION_OCTET_STREAM);
response = builder.post(entity);


I get the same message (different class, as expected) when I try InputStream
or File instead of byte[].  To my understanding, all these types shall be
handled automatically - there is no need for to register a custom
Provider/MessageBodyWriter. Am I wrong ?

PS All CXF examples on uploading multipart show the 2.7 style of using
WebClient.  Is there any CXF documentation on JAX-RS 2.0 style ?

Thanks a lot,
Liviu



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Unable-to-upload-file-content-using-CXF-3-0-0-and-Jackson-2-2-0-tp5754611.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to