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

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

GitHub user rdowner opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/730

    BROOKLYN-154: Don't call methods that might not be there

    This code attempted to call non-standard extensions on the 
`javax.ws.rs.core.Response` class. This change does the appropriate 
`instanceof` checks to ensure that no non-standard methods are called if
    we have a plain old Response object.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rdowner/incubator-brooklyn fix/BROOKLYN-154

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/730.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #730
    
----
commit b6a0023ab3d61bd7f0e9e49ffb9c762e8ac550bb
Author: Richard Downer <[email protected]>
Date:   2015-07-01T11:43:05Z

    BROOKLYN-154: Don't call methods that might not be there
    
    This code attempted to call non-standard extensions on the
    javax.ws.rs.core.Response class. This change does the appropriate
    instanceof checks to ensure that no non-standard methods are called if
    we have a plain old Response object.

----


> 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