I am trying to upload an image onto my server using rest webservices in java. But i keep getting an exception with the stacktrace.
Severe: The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for method public org.codehaus.jettison.json.JSONObject com.tazligen.service.UserService.uploadFile(java.io.InputStream) at parameter at index 0 SEVERE: Method, public org.codehaus.jettison.json.JSONObject com.tazligen.service.UserService.uploadFile(java.io.InputStream), annotated with POST of resource, class com.tazligen.service.UserService, is not recognized as valid resource method.
My simple code is:
@POST
@Path("/imagestore")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public JSONObject uploadFile(@FormDataParam("file") InputStream file) {
//Code
JSONObject obj = new JSONObject();
return obj;
}
I thought maybe the problem is with FormDataParam so i changed it to formparam so then i get this exception: javax.xml.ws.WebServiceException: class com.tazligen.service.jaxws.Test do not have a property of the name arg0
Which is as annoying. I m gonna use postman to upload the image and i am using formdataparam . I searched about the error but didn't find a convincing answer . So if someone would be kind enough to help me a littel i would really appreciate it :).