Hi,

The instance name must be globally unique. This constraints comes from the 
usage of this name as service.pid which must be unique for the whole platform).

About instance.name / name, it seems to be a bug, could you open an issue ?

Regards,

Clement

On 09.04.2012, at 03:59, Fabio Fonseca wrote:

> 
> Hi All,
> 
> I'm having a problem when trying to name an instance of a composite when I
> instantiate it inside another composite. My metadata is below:
> 
> <ipojo>
> 
> <composite name="comanche.requestHandler">
>       <instance
> component="org.apache.comanche.requestDispatcher.RequestDispatcher"
> name="RequestDispatcher"/>
>       <instance component="FileRH"/>
>       <instance component="ErrorRH"/>
>       <provides action="export"
>                 specification="org.apache.comanche.services.RequestHandler"
>                 filter="(instance.name=RequestDispatcher)" />
> </composite>
> 
> <composite name="comanche.backend">
>       <instance component="comanche.requestHandler" name="mytest123" />
> </composite>
> 
> <instance component="comanche.backend" name="teste" />
> 
> </ipojo>
> 
> You can see the instance name in the bold part. When I compile my bundle
> without that bold part, the higher level composite instance is valid, but
> when I use the "mytest123" name, the instance became invalid and I see a
> stack trace in my console that begins with:
> 
> 
> [ERROR] FileRH : The configuration is not acceptable : Name already used
> [ERROR] comanche.requestHandler : A factory is available for the
> configuration but the configuration is not acceptable
> org.apache.felix.ipojo.UnacceptableConfiguration: FileRH : Name already used
> : mytest123
>       at
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:290)
>       at
> org.apache.felix.ipojo.composite.FactoryProxy.createComponentInstance(FactoryProxy.java:87)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.__createInstance(InstanceHandler.java:160)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.createInstance(InstanceHandler.java)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.__bindFactory(InstanceHandler.java:184)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.bindFactory(InstanceHandler.java)
>       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at org.apache.felix.ipojo.util.Callback.call(Callback.java:260)
>       at
> org.apache.felix.ipojo.handlers.dependency.DependencyCallback.callOnInstance(DependencyCallback.java:309)
>       at
> org.apache.felix.ipojo.handlers.dependency.Dependency.invokeCallback(Dependency.java:315)
>       at
> org.apache.felix.ipojo.handlers.dependency.Dependency.onObjectCreation(Dependency.java:280)
>       at
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__onCreation(DependencyHandler.java:643)
>       at
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.onCreation(DependencyHandler.java)
>       at org.apache.felix.ipojo.HandlerManager.start(HandlerManager.java:132)
>       at
> org.apache.felix.ipojo.composite.CompositeManager.start(CompositeManager.java:355)
>       at
> org.apache.felix.ipojo.composite.CompositeFactory.createInstance(CompositeFactory.java:147)
>       at
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.__createInstance(InstanceHandler.java:160)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.createInstance(InstanceHandler.java)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.__bindFactory(InstanceHandler.java:184)
>       at
> org.apache.felix.ipojo.composite.instance.InstanceHandler.bindFactory(InstanceHandler.java)
>       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at org.apache.felix.ipojo.util.Callback.call(Callback.java:260)
>       at
> org.apache.felix.ipojo.handlers.dependency.DependencyCallback.callOnInstance(DependencyCallback.java:309)
>       at
> org.apache.felix.ipojo.handlers.dependency.Dependency.invokeCallback(Dependency.java:315)
>       at
> org.apache.felix.ipojo.handlers.dependency.Dependency.onObjectCreation(Dependency.java:280)
>       at
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__onCreation(DependencyHandler.java:643)
>       at
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.onCreation(DependencyHandler.java)
>       at org.apache.felix.ipojo.HandlerManager.start(HandlerManager.java:132)
>       at
> org.apache.felix.ipojo.composite.CompositeManager.start(CompositeManager.java:355)
>       at
> org.apache.felix.ipojo.composite.CompositeFactory.createInstance(CompositeFactory.java:147)
>       at
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
>       at
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
>       at
> org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343)
>       at
> org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
>       at org.apache.felix.ipojo.Extender.parse(Extender.java:306)
>       at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
>       at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>       at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
>       at java.lang.Thread.run(Thread.java:680)
> 
> Apparently it is mixing the instances with other names... pretty weird...
> :-/
> 
> I'm using the following bundles, all downloaded and compiled today:
> 
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (4.0.2)
> [   1] [Active     ] [    1] Apache Felix Bundle Repository (1.6.6)
> [   2] [Active     ] [    1] Apache Felix iPOJO (1.9.0.SNAPSHOT)
> [   3] [Active     ] [    1] Apache Felix iPOJO API (1.7.0.SNAPSHOT)
> [   4] [Active     ] [    1] Apache Felix iPOJO Arch Command
> (1.7.0.SNAPSHOT)
> [   5] [Active     ] [    1] Apache Felix iPOJO Composite (1.9.0.SNAPSHOT)
> [   6] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
> [   7] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
> 
> 
> Regards,
> Fabio
> 
> P.S.: When I start this composite bundle, I receive a warning about the
> instance "name" attribute that was deprecated. It tells me to use
> "instance.name". However, the "instance.name" seems not to be working,
> because, when I use it, the instance do not receive the name I desire. So I
> kept using the "name", who is working, even knowing it was deprecated.
> -- 
> View this message in context: 
> http://old.nabble.com/Cannot-name-an-instance-of-a-composite-inside-another-composite-using-1.9.0-snapshot-tp33653319p33653319.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to