You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Aled Sage (JIRA)" <ji...@apache.org> on 2017/01/09 14:09:58 UTC

[jira] [Created] (BROOKLYN-423) Upgrade cxf to 3.1.9 (in karaf)

Aled Sage created BROOKLYN-423:
----------------------------------

             Summary: Upgrade cxf to 3.1.9 (in karaf)
                 Key: BROOKLYN-423
                 URL: https://issues.apache.org/jira/browse/BROOKLYN-423
             Project: Brooklyn
          Issue Type: Improvement
    Affects Versions: 0.10.0
            Reporter: Aled Sage
            Priority: Minor


For why we want this, see https://github.com/cloudsoft/winrm4j/pull/44 (upgrading cxf to 3.1.9, and httpcomponents.httpclient to 4.5.2).

Also see https://github.com/apache/brooklyn-server/pull/362, which attempts to update httpcomponents' httpcore and httpclient. However, that breaks winrm4j if we don't also upgrade cxf (according to Svet's comment).

---
However, cxf 3.1.9 pulls in {{javax.ws.rs;version=2.0.1}}, which causes jclouds to fail to start because that needs 1.1.0 >= version < 2.0.0. The 2.0.1 version comes from feature cxf-core, which depends on feature cxf-specs, which depends on bundle org.apache.servicemix.specs.jsr339-api-2.0.1 (bundle version 2.6.0, but exports {{javax.ws.rs;version=2.0.1}})).

The jclouds error is:
{noformat}
2017-01-09 09:48:52,714 ERROR  40 o.a.k.s.s.ShellUtil [nsole user karaf] Exception caught while executing command
org.osgi.service.resolver.ResolutionException: Unable to resolve jclouds-core/2.0.0: missing requirement [jclouds-core/2.0.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=javax.ws.rs)(version>=1.1.0)(!(version>=2.0.0)))"
        at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:404)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:158)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)[11:org.apache.karaf.features.core:4.0.4]
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[11:org.apache.karaf.features.core:4.0.4]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1089)[11:org.apache.karaf.features.core:4.0.4]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:985)[11:org.apache.karaf.features.core:4.0.4]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_111]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_111]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
{noformat}

Looking at Brooklyn 0.10.0, it does include both 1.x and 2.x of javax.ws.rs:
{noformat}
karaf@brooklyn()> package:exports | grep javax.ws.rs
...
javax.ws.rs                                                       | 1.1.1            | 185 | org.apache.servicemix.bundles.jersey-core
javax.ws.rs                                                       | 2.0.0            | 194 | org.apache.servicemix.specs.jsr339-api-2.0
{noformat}

---
However, adding both bundle versions 1.1.1 and 2.0.1 gives the error shown below:

{noformat}
2017-01-09 10:25:41,238 ERROR  40 o.a.k.s.s.ShellUtil [nsole user karaf] Exception caught while executing command
org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource org.apache.brooklyn.rest-resources [org.apache.brooklyn.rest-resources/0.11.0.SNAPSHOT] because it is exposed to package 'javax.ws.
rs' from resources javax.ws.rs-api [javax.ws.rs-api/2.0.1] and org.apache.servicemix.specs.jsr311-api-1.1.1 [org.apache.servicemix.specs.jsr311-api-1.1.1/2.7.0] via two dependency chains.

Chain 1:
  org.apache.brooklyn.rest-resources [org.apache.brooklyn.rest-resources/0.11.0.SNAPSHOT]
    import: (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package: javax.ws.rs
  javax.ws.rs-api [javax.ws.rs-api/2.0.1]

Chain 2:
  org.apache.brooklyn.rest-resources [org.apache.brooklyn.rest-resources/0.11.0.SNAPSHOT]
    import: (&(osgi.wiring.package=io.swagger.jaxrs.listing)(version>=1.5.0)(!(version>=2.0.0)))
     |
    export: osgi.wiring.package=io.swagger.jaxrs.listing; uses:=javax.ws.rs
  io.swagger.jaxrs [io.swagger.jaxrs/1.5.6]
    import: (&(osgi.wiring.package=javax.ws.rs)(version>=1.1.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package: javax.ws.rs
  org.apache.servicemix.specs.jsr311-api-1.1.1 [org.apache.servicemix.specs.jsr311-api-1.1.1/2.7.0]
{noformat}

This is because brooklyn-rest-api pom.xml explicitly adds the OSGi import {{javax.ws.rs;version="[1.1,2.0]}}, with the commit (6f624c78b1e7fe72c6df1ecd297b922721b2c023) comment:
{noformat}
    There is no standard JAX-RS way to process multipart/form-data contents,
    so this service was removed from the API for the purpose of unifying the
    CXF and Jersey API.
    
    * Adjust OSGi package import directives to allow a version range of 1.1 to
    2.0 of JAX-RS directives.
{noformat}

---
Removing that from the pom (so brooklyn-rest-api depends on {{javax.ws.rs;version="[2.0,3)"}}), it seems to work (without having tested any api calls that require multipart/form-data).

However, it refreshes cxf core (and thus many other bundles) because of:
{noformat}
2017-01-09 11:31:43,748 INFO   11 o.a.k.f.i.s.FeaturesServiceImpl [pool-14-thread-1]     org.apache.httpcomponents.httpasyncclient/4.1.2 (Attached fragments changed: [org.apache.brooklyn.karaf-httpcomponents-extension/0.11.0.SNAPSHO
T])
{noformat}

The only purpose of https://github.com/apache/brooklyn-server/blob/master/karaf/httpcomponent-extension/pom.xml is to work around a bu in the httpasyncclient OSGi bundle (as described in the commit message below):

{noformat}
commit 470dda2ced543bf68f4ae931c5c7090a08d799f3
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Date:   Wed Aug 31 19:33:20 2016 +0300

    Fix winrm4j in Karaf
    
    winrm4j version update has fixed for OSGi. Also adding an extension bundle to httpcomponents-asyncclient so that it's able to see org.apache.http.ssl package (that's fixed in later revision releases of the jar).
{noformat}

This leads us back to https://github.com/apache/brooklyn-server/pull/362, which attempts to bump the httpclient and httpcore versions to 4.5.2 and 4.4.5 respectively. If we also update httpasyncclient then we shouldn't need that.




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