Maven jersey-multipart missing dependency for javax.ws.rs.core.Response

It seems that I have a missing dependency, but I can’t find a solution ... I made sure that all versions of knitwear are identical, as indicated here .

Mistake:

SEVERE: The following errors and warnings have been detected with resource and/or provider classes: SEVERE: Missing dependency for method public abstract javax.ws.rs.core.Response com.service.copy(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 0 

Dependencies Used:

 <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-servlet</artifactId> <version>1.17</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.17</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.17</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-bundle</artifactId> <version>1.17</version> </dependency> <dependency> <groupId>org.jvnet</groupId> <artifactId>mimepull</artifactId> <version>1.6</version> </dependency> 

Code in which the error occurs:

 @POST @Path("copy") public Response copy(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail); 

Any ideas? Thanks in advance, Frank

+6
source share
2 answers

Yes, he found it!

Apparently, the dependencies were in order.

Added them to my import

 import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; 

And changed the code to

 @POST @Path("copy") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response copy(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail); 

And now all of a sudden everything works! Therefore, I hope that I can help someone else with the same problem ...

+7
source

@FormDataParam seems very fussy about the @Consumes annotation. Please note that (unlike anything else) placing this annotation on the method interface definition is not enough for @FormDataParam !

+3
source

All Articles