I think the SCR impl should be more forgiving here. While the spec says the component name must be unique. This requirement is against the bundle developer. SCR can be more permissive and allow multiple bundles to use the same component name. Given that OSGi allows multiple versions of a bundle to be running, it seems likely that these bundles will use the same component names. I don't think we want to require a bundle developer to change component names for each release of her bundle just so SCR will allow multiple versions of the bundle to run. --
BJ Hargrave Senior Technical Staff Member, IBM OSGi Fellow and CTO of the OSGi Alliance [EMAIL PROTECTED] office: +1 386 848 1781 mobile: +1 386 848 3788 "Felix Meschberger" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 2007-06-25 08:36 Please respond to [email protected] To [email protected] cc Subject Re: Multiple versions of bundles using declarative services Hi Rajini, My understanding of the spec is to really only have a single instance of a component with a given name as the phrase sais "must be globally unique". I understand the follow up "because it is used as a PID" as just an explanaiton. Furthermore, the spec also says "A PID must be unique for each service. A bundle must not register multiple services with the same PID, nor should other bundles use the same PID. If this happens, it is an error condition" (Core Specification, Section 5.2.6). Consequently, I think the behaviour of Felix SCR is correct. Or am I wrong ? Regards Felix On 6/25/07, Rajini Sivaram <[EMAIL PROTECTED]> wrote: > > Hello, > > I have two versions of an OSGi bundle which use declarative services. Both > bundles use identical files for their component.xml file and hence use the > same component name. Equinox runs both components and creates services and > resolves references correctly. Felix throws an exception when trying to > start the version 2 bundle since the component name is already used for > version 1. From the OSGi spec, it is not clear whether it is permissible > to > have multiple DS components with the same name. It does say "The name of a > component must be globally unique because it is used as a PID in several > places". Since in this case, the components have identical configurations, > should the runtime prevent the starting of the bundle? I dont think > Equinox > does any checks for duplicate component names. > > > --- [RetailerComponent1] Exception with component : Cannot register > Component --- > > *org.osgi.service.component.ComponentException*: The component name > 'RetailerComponent1' has already been registered. > > at org.apache.felix.scr.ComponentRegistry.checkComponentName(* > ComponentRegistry.java:102*) > > at org.apache.felix.scr.BundleComponentActivator.initialize(* > BundleComponentActivator.java:139*) > > at org.apache.felix.scr.BundleComponentActivator.<init>(* > BundleComponentActivator.java:90*) > > at org.apache.felix.scr.Activator.loadComponents(*Activator.java:208*) > > at org.apache.felix.scr.Activator.bundleChanged(*Activator.java:157*) > > at > > org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback > (*EventDispatcher.java:637*) > > at > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately( > *EventDispatcher.java:566*) > > at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(* > EventDispatcher.java:480*) > > at org.apache.felix.framework.Felix.fireBundleEvent(*Felix.java:3366*) > > at org.apache.felix.framework.Felix._startBundle(*Felix.java:1315*) > > at org.apache.felix.framework.Felix.startBundle(*Felix.java:1243*) > > at org.apache.felix.framework.BundleImpl.start(*BundleImpl.java:350*) > > > -- > Thank you... > > Regards, > > Rajini >
