错误:ClassNotFoundException

时间:2017-07-05 08:00:23

标签: java rest

我正在尝试为下载zip文件编写Rest Api。我得到了以下的例外情况。 java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl。  我已在pom.xml文件

中定义了波纹管依赖项
<dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-common</artifactId>
            <version>2.22.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0</version>
        </dependency>`

我的休息api代码如下。

@GET
@RequestMapping(value="/zip")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response downloadZip() {
    String FILE_PATH = "C:\\VarunDoc\\Full_Zip.zip";
    File file = new File(FILE_PATH);
    ResponseBuilder response = Response.ok((Object) file);
    response.header("Content-Disposition", "attachment; filename=Full_Zip.zip");
    return response.build();
}

当我从邮递员那里点击URL时,我得到了上述异常。是什么导致错误。

0 个答案:

没有答案
相关问题