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 的依赖项
基础教程推荐
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 降序排序:Java Map 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01