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