【问题标题】:Karaf is unable to resolve bundle depending on ActiveMQ feature due to multiple Joda-Time versions由于多个 Joda-Time 版本,Karaf 无法根据 ActiveMQ 功能解析捆绑包
【发布时间】:2015-05-06 17:27:01
【问题描述】:

我的包对 Joda-Time 2.x 有一个交互包依赖,并通过 Karaf (3.0.3) 功能文件进行部署。在我向 Karaf 提供的 activemq-broker (5.11.1) 和 activemq-camel 功能添加依赖项之前,它部署得很好。我的包现在无法解析,因为找到了包“org.joda.time”的两条路径。一个是我所依赖的 2.7 版本,另一个是 1.6 版本,它是 ActiveMQ 功能的传递依赖:

Chain 1:
  ch.vivates.ams.pep [152.9]
    import: (&(osgi.wiring.package=org.joda.time)(version>=2.7.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package=org.joda.time
  joda-time [64.0]

Chain 2:
  ch.vivates.ams.pep [152.9]
    import: (osgi.wiring.package=org.apache.activemq)
     |
    export: osgi.wiring.package=org.apache.activemq; uses:=com.thoughtworks.xstream
  org.apache.activemq.activemq-osgi [108.0]
    import: (&(osgi.wiring.package=com.thoughtworks.xstream)(version>=1.4.0)(!(version>=2.0.0)))
     |
    export: osgi.wiring.package=com.thoughtworks.xstream; uses:=org.joda.time
  org.apache.servicemix.bundles.xstream [118.0]
    import: (&(osgi.wiring.package=org.joda.time)(version>=1.6.0)(!(version>=3.0.0)))
     |
    export: osgi.wiring.package=org.joda.time
  joda-time [117.0]

我可以通过在安装功能之前显式启动 Joda-Time 2.7 包来成功安装我的功能:

bundle:install -s mvn:joda-time/joda-time/2.7

重新启动 Karaf 后,我的包由于同样的原因无法启动,我首先必须刷新 Joda-Time 2.7 包。只有在那之后我的包才会开始。

解决这些问题的“正确”方法是什么?特别是重新启动Karaf时的那个?我想我可以通过将 Joda Time v2.7 嵌入到我自己的包中来解决这个问题,但这只是一个 hack。

目前该功能如下所示:

<feature name="name" version="3.0.0-SNAPSHOT" description="description">
        <details>details</details>
        <feature>http</feature>
        <feature>http-whiteboard</feature>
        <feature version="5.11.1">activemq-broker-noweb</feature>
        <feature version="2.14.1">camel-core</feature>
        <feature version="2.14.1">camel-blueprint</feature>
        <feature version="2.14.1">camel-netty4-http</feature>
        <feature version="2.14.1">camel-http4</feature>
        <feature version="2.14.1">camel-jms</feature>
        <feature version="5.11.1">activemq-camel</feature>
        <bundle dependency="true">mvn:my.package/base/3.0.0-SNAPSHOT</bundle>
        <bundle>mvn:my.package/myBundle/3.0.0-SNAPSHOT</bundle>
        <bundle>mvn:joda-time/joda-time/2.7</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml/2.6.1_3</bundle>
        <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
        <bundle>wrap:mvn:org.owasp.esapi/esapi/2.0.1</bundle>
        <bundle>mvn:org.apache.santuario/xmlsec/1.5.6</bundle>
        <bundle>mvn:org.bouncycastle/bcprov-jdk15/1.46</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/3.1_7</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections/3.2.1_3</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.not-yet-commons-ssl/0.3.11_1</bundle>
        <bundle>mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1</bundle>
        <bundle>mvn:org.codehaus.woodstox/stax2-api/3.1.4</bundle>
        <bundle>mvn:org.herasaf.xacml.core/herasaf-xacml-core/1.0.0.RELEASE</bundle>
        <bundle>mvn:net.sf.ehcache/ehcache/2.9.0</bundle>
        <bundle>mvn:commons-codec/commons-codec/1.9</bundle>
        <bundle>mvn:commons-io/commons-io/2.4</bundle>
</feature>

编辑:

issue 描述了 Camel Salesforce 组件的相同问题。显然,这是由导入到 [1.6,3) 的widening the version range 修复的。 ActiveMQ 捆绑包应用相同的版本范围,但仍然会产生问题。

【问题讨论】:

    标签: apache-camel activemq apache-karaf


    【解决方案1】:

    上述场景是 Neil Bartlett 在blog post 中描述的问题的变体。由于我无法控制 ActiveMQ 的直接和传递依赖关系,所以我能看到的唯一选项是

    1. 降级我自己对 Joda-Time 的依赖以匹配 xstream 使用的版本
    2. Statically link/在我自己的包中嵌入 Joda-Time 2.7

    我选择了选项 2)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-08
      • 2021-04-23
      • 1970-01-01
      • 2014-09-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多