【问题标题】:Deployment difference between karaf feature bundle and karaf bundle:installkaraf feature bundle 和 karaf bundle 部署区别:安装
【发布时间】:2018-07-15 16:36:57
【问题描述】:

以下两种部署有何不同

<feature name="my-base-bundles" version="${project.version}">
        <bundle start-level="86">mvn:com.my.osgi/mycomponent/0.0.1</bundle>
</feature>

bundle:install -s mvn:com.my.osgi/mycomponent/0.0.1

我观察到的是部署功能显示服务:类似列表

[com.my.osgi.mycomponent]
-----------------------------------------------------
instance.name = mycomponent.3c2c91a5-4c28-46c3-a08e-1470192ef353
 service.bundleid = 76
 service.factoryPid = com.my.osgi.mycomponent
 service.id = 397
 service.pid = com.my.osgi.mycomponent.3c2c91a5-4c28-46c3-a08e-1470192ef353
 service.scope = bundle

并通过使用 bundle:install 进行部署

[org.apache.felix.ipojo.Factory]
--------------------------------
 component.class = com.my.osgi.mycomponent
 component.description = factory name="com.my.osgi.mycomponent" bundle="77" state="valid" implementation-class="com.my.osgi.mycomponent"
        requiredhandlers list="[org.apache.felix.ipojo:properties, org.apache.felix.ipojo:callback, org.apache.felix.ipojo:provides, org.apache.felix.ipojo:architect
ure]"
        missinghandlers list="[]"
        provides specification="com.my.osgi.mycomponent"
        inherited interfaces="[com.my.osgi.mycomponent]" superclasses="[]"
 component.providedServiceSpecifications = [com.my.osgi.mycomponent]
 factory.name = com.my.osgi.mycomponent
 factory.state = 1
 service.bundleid = 77
 service.id = 153
 service.pid = com.my.osgi.mycomponent
 service.scope = singleton

它工作正常,但我的 pax-exam 测试失败了,因为安装后我正在寻找服务

serviceReferences = this.bundleContext.getServiceReferences("com.my.osgi.mycomponent", filter);

我应该如何在 pax-exam 中进行部署,以便我可以访问功能部署等服务?

【问题讨论】:

    标签: apache-karaf pax-exam


    【解决方案1】:

    两个安装的启动级别不同。

    • 功能安装:开始级别 = 86 显式
    • 捆绑安装:启动级别 = 默认 = 90 隐式

    所以尝试使用一些启动级别值安装捆绑包

    【讨论】:

      猜你喜欢
      • 2012-07-08
      • 2015-12-05
      • 1970-01-01
      • 2016-05-15
      • 1970-01-01
      • 2018-07-26
      • 2018-07-24
      • 2017-07-01
      • 2018-04-02
      相关资源
      最近更新 更多