gpt4 book ai didi

java - 执行文件上传休息 Web 服务时缺少方法的依赖性

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:05:56 28 4
gpt4 key购买 nike

我一直在尝试了解如何修复此错误:

SEVERE: Missing dependency for method public java.lang.String com.myrest.FileService.uploadFile(java.io.File,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 0SEVERE: Missing dependency for method public java.lang.String com.myrest.FileService.uploadFile(java.io.File,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 1SEVERE: Method, public java.lang.String com.myrest.FileService.uploadFile(java.io.File,com.sun.jersey.core.header.FormDataContentDisposition), annotated with POST of resource, class com.myrest.FileService, is not recognized as valid resource method.

I am working with a Apache Jersey based rest web service and doing a upload service.

Anyone have encountered this error before?

I am getting this error for this code:

    @POST
@Path("/upload{path:.*}")
@Consumes("multipart/form-data")
@Produces("text/plain")
public String uploadFile(
@FormDataParam("file") File file,
@FormDataParam("file") FormDataContentDisposition fileDetail) {

String fileLocation = "/files/" + fileDetail.getFileName();
System.out.println("Copying file to : " + fileLocation);
return "1";
}

最佳答案

在我的例子中,问题是 jersey-bundlecom.sun.jersey.contribs 的库版本不同;在将两者设置为相同版本后,一切正常。

关于java - 执行文件上传休息 Web 服务时缺少方法的依赖性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8658699/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com