Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I seem to have a missing dependency but can't find the solution... I've made sure all jersey versions are identical as answered here.

Error:

  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 where the error happens:

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

Any ideas? Thanks a lot in advance, Frank

like image 504
Frank Avatar asked May 30 '13 08:05

Frank


1 Answers

Yeah found it!

Apparently the dependencies were OK.

Added these to my imports

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 suddenly everything works! So hope I can help someone else with the same problem...

like image 74
Frank Avatar answered Oct 13 '22 13:10

Frank