2015-11-08 53 views
0

我试图用我已经发布在这个link中的示例来安装apache-karaf 2.3.10的OSGi包。我做了以下步骤在karaf中安装scr特性之后,激活方法被调用了两次

1. Downloaded apache-karaf version 2.3.10 
2. Executed the command features:install scr. Successfully installed scr. I have verified by executing scr:list 
3. Installed all the bundles 
4. Finally after starting all the bundles activate method in ExampleComponentFactoryManager called twice and two objects are created. I have verified the same by executing the command scr:list 
5. After uninstalling the scr feature the activate method in ExampleComponentFactoryManager called only once which is the expected behaviour. 
6. Also i have noted that upto apache-karaf-2.3.10 while installing the scr feature it fetches from the online repo. But from 2.3.11 i am getting error because it tries to fetch it from my maven repository. The error is shown the console. 

有人可以告诉我在卡拉夫特征scr发生了什么? 因为有了scr功能,我可以看到karaf中有哪些可用的工厂和实例。这是预期的吗?

回答

1

你可以检查是否有两个运行felix scr软件包的实例。这将解释双重对象的创造。

+0

刚刚执行了命令“features:install scr”命令。我不知道内部实现。如果可能的话,我可以分享我的测试包,以便您可以在2.3.10以及其他版本中使用它。因为正如你所说,在热部署文件夹中存在一个问题,我尝试通过使用命令'install'文件安装捆绑包:<捆绑包的路径>' – Shriram

+0

您可以使用la -s检查已安装的捆绑包并查看是否存在多于一个scr impl安装? –

+0

是的,有两个org.apache.feilx.scr一个版本1.8.2和一个1.6.0。无论如何它不应该激活两次对吗? – Shriram