找不到ClientBuilder类 [英] ClientBuilder class not found

查看:365
本文介绍了找不到ClientBuilder类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Jersey框架构建RESTFul客户端,因此我添加了以下类:

I am trying to build a RESTFul client using Jersey framework, so I added the following class:

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

public class ActivityClient {
    private Client client;  
    public ActivityClient(){        
        client = ClientBuilder.newClient();
    }   
        //...code
}

但是我找不到ClientBuilder的错误类,即使我在WEB-INF / lib和应用程序类路径下有以下jar:

but I am getting an error class ClientBuilder not found, even though I have the following jars under WEB-INF/lib and under the application class path:

asm-3.1.jar
jackson-core-asl-1.9.2.jar
jackson-jaxrs-1.9.2.jar
jackson-mapper-asl-1.9.2.jar
jackson-xc-1.9.2.jar
jersey-client-1.17.1.jar
jersey-core-1.17.1.jar
jersey-json-1.17.1.jar
jersey-server-1.17.1.jar
jersey-servlet-1.17.1.jar
jettison-1.1.jar
jsr311-api-1.1.1.jar

那么有人可以告诉我我在这里缺少哪个罐子吗?我在哪里可以找到它?我搜索过网络,我发现唯一一个ClientBuilder与RESTEasy框架相关的jar,所以我认为它不相关。

So can someone please tell me which jar I am missing here? and where I can find it? I have searched the web and the only jar I found that has ClientBuilder is related to the RESTEasy framework, so I don't think that it is related.

谢谢你的支持时间

推荐答案

据我所知, ClientBuilder 是Jersey 2.x API的一部分,您正在使用Jersey 1.17.1。所以要么使用新版本,要么使用可以找到的1.17.1 API 这里

As far as I can see, ClientBuilder is part of the Jersey 2.x API, and you are using Jersey 1.17.1. So either use a new version, or use the 1.17.1 API which can be found here

这篇关于找不到ClientBuilder类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆