Skip to content
Advertisement

Class not found com.sun.ws.rs.ext.RuntimeDelegateImpl on ubuntu tomcat

I’m using GWT/P to build a webapp which uses javax.ws.rs.client to communicate with rest services.

Jersey client is used:

<jersey.version>2.22.2</jersey.version>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey</groupId>
            <artifactId>jersey-bom</artifactId>
            <version>${jersey.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-moxy</artifactId>
</dependency>

It’s deployed on tomcat (7 and 9 versions, both work as expected). However, on one ubuntu server, using tomcat 9 I get following exception:

Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
    at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:122)
    at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91)
    at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69)
    at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80)
    at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:99)
    at org.glassfish.jersey.client.JerseyWebTarget.<init>(JerseyWebTarget.java:71)
    at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:290)
    at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:76)

I don’t know why is it looking for com.sun.ws.rs.ext.RuntimeDelegateImpl instead of org.glassfish.jersey.internal.RuntimeDelegateImpl, and that it happens only on that particular server (windows, amazon AWS linux, docker linux works fine).

I have tried increasing jersey version to 2.27 (can’t increase it more, since newer versions conflict with GWT jetty 9.2.14).

I have tried adding META-INF/services/javax.ws.rs.ext.RuntimeDelegate with first line as org.glassfish.jersey.internal.RuntimeDelegateImpl.

Nothing seems to work. What am I missing here? Any ideas?

Advertisement

Answer

gwt-rest-dispatch was including jsr311-api.jar, which was causing the issues. Removing this dependency (since my project does not use it) solved this.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement