Apache camel 由于存在多个Joda Time版本,Karaf无法根据ActiveMQ功能解析捆绑包

Apache camel 由于存在多个Joda Time版本,Karaf无法根据ActiveMQ功能解析捆绑包,apache-camel,activemq,apache-karaf,Apache Camel,Activemq,Apache Karaf,我的bundle在Joda Time 2.x上有一个Transactive bundle依赖项,并通过Karaf(3.0.3)功能文件进行部署。在我将依赖项添加到Karaf提供的activemq代理(5.11.1)和activemq camel功能之前,它的部署还不错。我的包现在无法解析,因为找到了指向包“org.joda.time”的两条路径。一个是我所依赖的版本2.7,另一个是版本1.6,它是ActiveMQ功能的可传递依赖项: Chain 1: ch.vivates.ams.pep [

我的bundle在Joda Time 2.x上有一个Transactive bundle依赖项,并通过Karaf(3.0.3)功能文件进行部署。在我将依赖项添加到Karaf提供的
activemq代理
(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嵌入到我自己的包中来解决这个问题,但这只是一个技巧

目前,该功能如下所示:

<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>

细节
http
http白板
activemq代理noweb
驼芯
骆驼蓝图
camel-netty4-http
骆驼-http4
骆驼jms
activemq骆驼
mvn:my.package/base/3.0.0-SNAPSHOT
mvn:my.package/myBundle/3.0.0-SNAPSHOT
mvn:joda time/joda time/2.7
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml/2.6.1\u 3
mvn:commons-lang/commons-lang/2.6
wrap:mvn:org.owasp.esapi/esapi/2.0.1
mvn:org.apache.santuario/xmlsec/1.5.6
mvn:org.bounchycastle/bcprov-jdk15/1.46
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/3.17
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections/3.2.13
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.not-yet-commons-ssl/0.3.111
mvn:org.codehaus.woodstox/woodstox核心asl/4.4.1
mvn:org.codehaus.woodstox/stax2 api/3.1.4
mvn:org.herasaf.xacml.core/herasaf-xacml-core/1.0.0.RELEASE
mvn:net.sf.ehcache/ehcache/2.9.0
mvn:commons编解码器/commons编解码器/1.9
mvn:commons io/commons io/2.4
编辑:


这为Camel Salesforce组件描述了相同的问题。显然,这是由[1.6,3]导入的一部分修复的。ActiveMQ捆绑包应用相同的版本范围,但仍然会产生问题。

上述场景是Neil Bartlett在本文中描述的问题的变体。由于我无法控制ActiveMQs的直接依赖项和传递依赖项,因此我可以看到的唯一选项是

  • 降级我自己对Joda Time的依赖,以匹配xstream使用的版本
  • /将Joda Time 2.7嵌入到我自己的包中
  • 我选择了选项2)