Spark8006 Spark8006 - 6 days ago 5
reST (reStructuredText) Question

org.glassfish.jersey.internal.RuntimeDelegateImpl NOT FOUND

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

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.UriBuilder
and have
jersey-common 2.0
that should contain the delegate in my build path. But I still get this error.

Does someone know how to fix it? Thanks!

Answer

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

<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:

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