Maven jersey-multipart missing dependency for 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 的依赖项
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01