Maven jersey-multipart 缺少 javax.ws.rs.core.Response 的依赖项

Maven jersey-multipart missing dependency for javax.ws.rs.core.Response(Maven jersey-multipart 缺少 javax.ws.rs.core.Response 的依赖项)

本文介绍了Maven jersey-multipart 缺少 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.

错误:

  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

使用的依赖项:

<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>

发生错误的代码:

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

有什么想法吗?非常感谢提前,弗兰克

Any ideas? Thanks a lot in advance, Frank

推荐答案

是的,找到了!

显然依赖是好的.

将这些添加到我的导入中

Added these to my imports

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

并将代码改为

@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...

这篇关于Maven jersey-multipart 缺少 javax.ws.rs.core.Response 的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Maven jersey-multipart 缺少 javax.ws.rs.core.Response 的依赖项

基础教程推荐