0

I am trying to install an OSGi bundle with the apache-karaf 2.3.10 with the example i have already posted in this link. I did the following steps

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.

Can anybody tell me what is happening with the feature scr inside karaf? Because with scr feature i can see what are the available factories and instances in karaf. Is this the expected one?

Community
  • 1
  • 1
Shriram
  • 4,343
  • 8
  • 37
  • 64

1 Answers1

1

Can you check if there are maybe two instances of the felix scr bundle running. That would explain the double object creation.

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • Just executed the command "features:install scr" command. I don't know about the internal implementation. If possible i can share my test bundles so that you can try it with 2.3.10 as well as in other versions. Because as you said there is a issue in hot deploy folder i tried by installing the bundles using command 'install 'file:' – Shriram Nov 08 '15 at 15:25
  • Can you check the installed bundles with la -s and look if there is more than one scr impl installed? – Christian Schneider Nov 08 '15 at 15:46
  • yep there are two org.apache.feilx.scr one with version 1.8.2 & one with 1.6.0. Anyway it should not activate twice right? – Shriram Nov 08 '15 at 16:04
  • Because OSGi supports installation of same bundles with same version. From this the if two version of same bundle is present then two times activate will be called and leads to duplication of object creation right? – Shriram Nov 08 '15 at 16:11
  • Yes. Normally installing two versions of a bundle is not a big problem. In this case though the scr bundle implements the extender pattern. Which means each of the scr bundles will work on every user bundle and each will create all objects. So for extender bundles like scr it is important to install only one version. – Christian Schneider Nov 08 '15 at 20:17