Missing dependency for method public org.codehaus.jettison.json.JSONObject

混江龙づ霸主 提交于 2019-12-11 02:36:30

问题


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 :).

来源:https://stackoverflow.com/questions/35816004/missing-dependency-for-method-public-org-codehaus-jettison-json-jsonobject

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!