0

I have a Java application deployed on Jetty server, and I am using Jersey. Once I try to open the URL, I recieve an HTTP 500 error with the following message. I have read other posts regarding this error, saying that the problem is caused by multiple versions of Jersey and having two UriBuilder classes, but I have one version of UriBuilder class and the same version of Jersey.

 java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
        at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:649)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:543)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:118)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:513)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.eclipse.jetty.server.Server.handle(Server.java:564)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
        at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:258)
        at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:147)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
        at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
    at java.lang.Thread.run(Thread.java:748)

here are my dependencies from gradle :

sourceCompatibility = 1.6
targetCompatibility = 1.6

repositories {
    maven { url("https://plugins.gradle.org/m2/") }
    mavenCentral()
}

buildscript {
    repositories {
        maven { url("https://plugins.gradle.org/m2/") }
        mavenCentral()
    }
    dependencies { classpath 'com.netflix.nebula:gradle-ospackage-plugin:1.9.2' }
}

ext.jerseyVersion='1.17.1'
ext.jettyVersion='9.4.3.v20170317'
ext.glassfishVersion='2.9.1'

dependencies {
    compile "com.google.code.gson:gson:2.8.0"

    compile "com.sun.jersey:jersey-core:${jerseyVersion}"
    compile "com.sun.jersey:jersey-grizzly2:${jerseyVersion}"
    compile "com.sun.jersey:jersey-json:${jerseyVersion}"
    compile "com.sun.jersey:jersey-server:${jerseyVersion}"
    compile "com.sun.jersey:jersey-servlet:${jerseyVersion}"

    compile "com.sun.jersey.contribs:jersey-multipart:${jerseyVersion}"
    compile "com.sun.jersey.contribs:jersey-spring:${jerseyVersion}"

    compile 'commons-io:commons-io:2.4'

    compile 'javax.inject:javax.inject:1'

    compile 'javax.ws.rs:jsr311-api:1.1.1'

    testCompile 'junit:junit:4.10'

    testCompile group: 'org.jmock', name: 'jmock-junit4', version: '2.6.0'

    testCompile group: 'org.jmock', name: 'jmock-legacy', version: '2.6.0'

    testCompile group: 'cglib', name: 'cglib-nodep', version: '2.1_3'

    testCompile group: 'org.objenesis', name: 'objenesis', version: '1.0'

    testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'

    testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'

    compile 'log4j:log4j:1.2.17'

    compile 'org.apache.commons:commons-math3:3.2'

    compile 'org.clojure:clojure:1.6.0'

    compile "org.eclipse.jetty:jetty-server:${jettyVersion}"
    compile "org.eclipse.jetty:jetty-servlet:${jettyVersion}"
    compile "org.eclipse.jetty:jetty-webapp:${jettyVersion}"

    compile 'org.freemarker:freemarker:2.3.20'

    compile "org.glassfish.jersey.core:jersey-client:${glassfishVersion}"
    compile "org.glassfish.jersey.containers:jersey-container-grizzly2-servlet:${glassfishVersion}"
    compile "org.glassfish.jersey.connectors:jersey-grizzly-connector:${glassfishVersion}"
    compile 'com.hazelcast:hazelcast:2.6'
    compile 'org.springframework:spring-context:3.2.1.RELEASE'
    compile 'org.springframework:spring-core:3.2.1.RELEASE'
    compile 'org.springframework:spring-web:3.2.1.RELEASE'

    compile 'org.yaml:snakeyaml:1.12'
    compile 'org.quartz-scheduler:quartz:2.2.1'

}
Tiara
  • 59
  • 6
  • 2
    Probably just a mismatched version of your ws dependencies. Can you list your runtime dependencies / jars? – Joakim Erdfelt Jul 12 '18 at 23:15
  • Most likely the version of the Jetty library you have in your development environment is different from the one installed in your deployment server. In your IDE the method is concrete, but in the server it is abstract. – Jim Garrison Jul 12 '18 at 23:16
  • The [`uri(String)`](https://docs.oracle.com/javaee/7/api/javax/ws/rs/core/UriBuilder.html#uri-java.lang.String-) method was added in JAX-RS 2.0. Seems you Jersey version is not JAX-RS 2.0. – Andreas Jul 12 '18 at 23:20
  • @JoakimErdfelt I added the dependencies to the post – Tiara Jul 12 '18 at 23:28
  • Why do you have both Jersey 1.x and Jersey 1.x dependencies in your project? Choose one and remove the other. Remove everything org.glassfish.jersey – Paul Samsotha Jul 12 '18 at 23:41
  • I mean Jersey 1.x and Jersey 2.x – Paul Samsotha Jul 12 '18 at 23:55
  • @PaulSamsotha because they don't exist in 1.17.1 version – Tiara Jul 12 '18 at 23:58
  • Sorry, but I don't understand what yo mean. In your post you said that you don't have two different versions of Jersey, but you do. com.sun.jersey is Jersey 1.x and og.glassfish.jersey is Jersey 2.x These are don't play well together. Use one or the other. Remove whatever one you don't use. – Paul Samsotha Jul 12 '18 at 23:59

0 Answers0