felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BJ Hargrave <hargr...@us.ibm.com>
Subject Re: Multiple versions of bundles using declarative services
Date Tue, 26 Jun 2007 08:20:58 GMT
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

office: +1 386 848 1781
mobile: +1 386 848 3788

"Felix Meschberger" <Felix.Meschberger@day.com> 
Sent by: fmeschbe@gmail.com
2007-06-25 08:36
Please respond to


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". 
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 
service. A bundle must not register multiple services with the same PID, 
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 ?


On 6/25/07, Rajini Sivaram <rajinisivaram@googlemail.com> wrote:
> Hello,
> I have two versions of an OSGi bundle which use declarative services. 
> bundles use identical files for their component.xml file and hence use 
> same component name. Equinox runs both components and creates services 
> 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 
> component must be globally unique because it is used as a PID in several
> places". Since in this case, the components have identical 
> 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 
>     at 
>     at
> (*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 
>     at org.apache.felix.framework.Felix._startBundle(*Felix.java:1315*)
>     at org.apache.felix.framework.Felix.startBundle(*Felix.java:1243*)
>     at 
> --
> Thank you...
> Regards,
> Rajini

View raw message