Uploaded image for project: 'Brooklyn'
  1. Brooklyn
  2. BROOKLYN-154

NoSuchMethodError: javax.ws.rs.core.Response.close()V

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.7.0
    • 0.8.0
    • None

    Description

      While attempting to use brooklyn-rest-client in my project, I came across this error:

      ava.lang.NoSuchMethodError: javax.ws.rs.core.Response.close()V
      	at brooklyn.util.http.BuiltResponsePreservingError.copyResponseAndClose(BuiltResponsePreservingError.java:65) ~[brooklyn-rest-client-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
      	at brooklyn.rest.client.BrooklynApi$1.invoke(BrooklynApi.java:135) ~[brooklyn-rest-client-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
      	at com.sun.proxy.$Proxy75.createFromYaml(Unknown Source) ~[na:na]
      

      On examining the problem, the implementation of javax.ws.rs.core.Response that was being picked up did indeed not have a close() method.

      I examined the dependencies of the brooklyn-rest-client module. It turns out that there are three dependencies that provide javax.ws.rs.core.Response:

      • javax.ws.rs:jsr311-api:jar:1.1.1:compile
      • com.sun.jersey:jersey-core:jar:1.18.1:compile
      • org.jboss.resteasy:jaxrs-api:jar:3.0.8.Final:compile

      Of these, only the last one provides a close() method - the other two are both much smaller classes. So this project has transitive dependencies that are mutually exclusive!

      It seems that in many cases the JVM is putting the last one in the right place to enable this class to compile and execute. But in some cases at runtime the wrong one appears in its place and causes runtime errors like this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rdowner Richard Downer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: