Jersey client exception: A message body writer was not found

Register the MultiPartWriter provider when creating the Client:

ClientConfig cc = new DefaultClientConfig();
Client client;

cc.getClasses().add(MultiPartWriter.class);
client = Client.create(cc);

If using Maven, these are the dependencies you need in your pom.xml:

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-client</artifactId>
    <version>1.17.1</version>
</dependency>
<dependency>
    <groupId>com.sun.jersey.contribs</groupId>
    <artifactId>jersey-multipart</artifactId>
    <version>1.17.1</version>
</dependency>

Leave a Comment