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

查看:41
本文介绍了未找到 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 not found,即使我在 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的jar与RESTEasy框架有关,所以我认为它不相关.

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天全站免登陆