2015-11-08 52 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