Here is my ajax call:
uploadExcel : function(jsonData,success, error) {
var url = "/TestProject/test/Uploader;
$.ajaxFileUpload({
url : url,
secureuri : false,
fileElementId : 'FileUpload',
contentType : 'multipart/form-data',
dataType : 'jsonString',
processData : false,
type : 'POST',
data: jsonData,
success : success,
error : error
});
}
Java Method signature:
@Path("/Uploader")
@POST
@Consumes('multipart/form-data')
public String validateAndUpload(@FormDataParam("FileUpload") byte[] inputByteArray,
@Context HttpServletRequest request,
@FormParam("jsonData") String uploadData) {}
Here is the error I'm getting
Here is the stackTrace:
SEVERE: Servlet.service() for servlet [ServletAdaptor] in context with path [/TestProject] threw exception [com.sun.jersey.api.container.ContainerException: Exception obtaining parameters] with root cause
java.lang.NullPointerException
at com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:43)
at com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider$FormDataInjectableValuesProvider.getInjectableValues(FormDataMultiPartDispatchProvider.java:115)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:126)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:154)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:163)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
Try:
Instead of:
According to
FormDataParam
API, the following is supported:From the javadoc: