Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling multipart/form-data input

Tags:

java

rest

jersey

I just tried using FormDataMultiPart but unfortunately it doesn't seem to help. Now I get the following error message:

SEVERE: A message body reader for Java class com.sun.jersey.multipart.FormDataMultiPart, and Java type class com.sun.jersey.multipart.FormDataMultiPart, and MIME media type multipart/form-data; boundary=----------Ef1gL6cH2ae0gL6Ij5cH2Ef1KM7Ij5 was not found.
The registered message body readers compatible with the MIME media type are:
*/* ->
  com.sun.jersey.core.impl.provider.entity.FormProvider
  com.sun.jersey.core.impl.provider.entity.StringProvider
  com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
  com.sun.jersey.core.impl.provider.entity.FileProvider
  com.sun.jersey.core.impl.provider.entity.InputStreamProvider
  com.sun.jersey.core.impl.provider.entity.DataSourceProvider
  com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
  com.sun.jersey.core.impl.provider.entity.ReaderProvider
  com.sun.jersey.core.impl.provider.entity.DocumentProvider
  com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader
  com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
  com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
  com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
  com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
  com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
  com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
  com.sun.jersey.core.impl.provider.entity.EntityHolderReader
  com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy

Is is a server-side or client side problem?

The client side code I have is taken from this site

like image 986
quarks Avatar asked Dec 29 '11 01:12

quarks


2 Answers

A google search for "SEVERE: A message body reader for Java" turns up this nugget at http://jersey.576304.n2.nabble.com/SEVERE-A-message-body-reader-for-Java-class-com-sun-jersey-multipart-FormDataMultiPart-and-Java-typed-td5969276.html

"...Please make sure you have mimepull.jar on the classpath..."

Looks a lot like your stacktrace, no? I'd have to say something is missing server-side.

like image 180
Bob Kuhar Avatar answered Oct 24 '22 11:10

Bob Kuhar


resolved:

include mimepull-1.6.jar
like image 36
Anil Kapoor Avatar answered Oct 24 '22 12:10

Anil Kapoor