[ 
https://issues.apache.org/jira/browse/BROOKLYN-154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14611722#comment-14611722
 ] 

ASF GitHub Bot commented on BROOKLYN-154:
-----------------------------------------

Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/730#discussion_r33762304
  
    --- Diff: 
usage/rest-client/src/main/java/brooklyn/util/http/BuiltResponsePreservingError.java
 ---
    @@ -62,7 +64,8 @@ public BuiltResponsePreservingError(int status, 
Headers<Object> headers, Object
                 Exceptions.propagateIfFatal(e);
                 return new BuiltResponsePreservingError(status, headers, 
entity, new Annotation[0], e);
             } finally {
    -            source.close();
    +            if (source instanceof BaseClientResponse)
    --- End diff --
    
    Why only call `close()` if it's an instance of `BaseClientResponse`? The 
close method is on `javax.ws.rs.core.Response`, so should we always call close?


> NoSuchMethodError: javax.ws.rs.core.Response.close()V
> -----------------------------------------------------
>
>                 Key: BROOKLYN-154
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-154
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.7.0-SNAPSHOT
>            Reporter: Richard Downer
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to