Java org.glassfish.jersey.internal.RuntimeDelegateImpl 未找到

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19452887/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 17:19:32  来源:igfitidea点击:

org.glassfish.jersey.internal.RuntimeDelegateImpl NOT FOUND

javarestglassfishjerseyjax-rs

提问by Spark8006

I am using jersey for my project and tring to parse a URI from a string.

我正在为我的项目使用 jersey,并从字符串中解析 URI。

UriBuilder.fromUri("http://localhost:8000").build();

The code is simple, but I get a error below

代码很简单,但我在下面收到错误

java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl

It seems the program can not find the delegate. I already imported javax.ws.rs.core.UriBuilderand have jersey-common 2.0that should contain the delegate in my build path. But I still get this error.

程序似乎找不到委托。我已经导入javax.ws.rs.core.UriBuilder并且jersey-common 2.0应该在我的构建路径中包含委托。但我仍然收到这个错误。

Does someone know how to fix it? Thanks!

有人知道如何解决吗?谢谢!

采纳答案by Archimedes Trajano

If you're using Maven, use the following dependency:

如果您使用 Maven,请使用以下依赖项:

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-common</artifactId>
    <version>2.22.2</version>
    <scope>test</scope>
</dependency>

For Gradle, the following will work:

对于 Gradle,以下内容将起作用:

testCompile 'org.glassfish.jersey.core:jersey-common:2.22.2'

回答by Shahadet

In my case the problem was for another Jar being used named: javax.ws.rs-api-2.0.jar

在我的情况下,问题是另一个正在使用的 Jar 名为: javax.ws.rs-api-2.0.jar

Removing that jar solved my problem.

删除那个罐子解决了我的问题。

The jar that I have used:

我用过的罐子:

<include name="jersey-client-1.9.jar" />
<include name="jersey-core-1.9.jar" />
<include name="jersey-multipart-1.9.jar" />

回答by Thomas Newman

Developing against a Wildfly 10.1 runtime I didn't want to introduce Jersey into my builds. With Gradle I used

针对 Wildfly 10.1 运行时进行开发 我不想将 Jersey 引入我的构建中。使用 Gradle 我用过

testRuntime "org.jboss.resteasy:resteasy-jaxrs:$versions.resteasy"

resteasy version is 3.0.19.Final. This jar contains

resteasy 版本是 3.0.19.Final。这个罐子里有

META-INF/services/javax.ws.rs.ext.RuntimeDelegate

with an entry

有条目

org.jboss.resteasy.spi.ResteasyProviderFactory

回答by Adrienne Dunham

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-common</artifactId>
    <version>2.26</version>
    <scope>test</scope>
</dependency>

I ran into issues with Java 8 and jersey-common 2.22.2 but 2.26 worked.

我遇到了 Java 8 和 jersey-common 2.22.2 的问题,但 2.26 有效。