ClientBuilder class not found(未找到 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 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:未找到 ClientBuilder 类


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