karaf功能包和karaf包之间的部署差异:安装

时间:2018-07-15 16:36:57

标签: apache-karaf pax-exam

下面两个部署有何不同

<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

我观察到的部署功能显示service:list like

[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考试测试失败,因为安装后我需要维修

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

我应该如何在pax考试中进行部署,以便我可以访问功能部署之类的服务?

1 个答案:

答案 0 :(得分:0)

两个安装之间的开始级别不同。

  • 功能安装:开始级别= 86 明确
  • 捆绑安装:开始级别=默认= 90 隐含

因此,请尝试使用一些起始级别的值安装捆绑软件