Hi,

It's a NPE occurring in your code (line 15). Could you show us your code ?

Regards,

Clement

On 15.06.2012, at 02:40, fabiolf wrote:

> Hello all,
> 
> I am trying to create a component that tells me when instances became valid.
> To do this I have created a component that has a field injection of type
> Architecture[] and configured it with the metadata below:
> 
> <iPOJO>
>       <component classname="org.test.iPOJO.archtest.ArchTestImpl"
> immediate="true">
>               <Provides />
>               <requires field="m_arch" aggregate="true">
>                   <callback type="bind" method="bindArch" />
>                   <callback type="unbind" method="unbindArch" />
>               </requires>
>       </component>
> 
>       <instance component="org.test.iPOJO.archtest.ArchTestImpl"
> name="archtest"/>
> </iPOJO>
> 
> When I start it bundle I receive the error below:
> 
> -> start 12
> -> [ERROR]  : The method bindArch in the implementation class
> org.test.iPOJO.archtest.ArchTestImpl throws an exception : null
> java.lang.NullPointerException
>       at org.test.iPOJO.archtest.ArchTestImpl.__bindArch(ArchTestImpl.java:15)
>       at org.test.iPOJO.archtest.ArchTestImpl.bindArch(ArchTestImpl.java)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       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.InstanceManager.getPojoObject(InstanceManager.java:870)
>       at
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:156)
>       at
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
>       at
> org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:472)
>       at 
> org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:354)
>       at
> org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:178)
>       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)
> [ERROR] org.test.iPOJO.archtest.ArchTestImpl : null
> java.lang.NullPointerException
>       at
> org.apache.felix.ipojo.util.DependencyModel.getService(DependencyModel.java:911)
>       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.InstanceManager.getPojoObject(InstanceManager.java:870)
>       at
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:156)
>       at
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
>       at
> org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:472)
>       at 
> org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:354)
>       at
> org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:178)
>       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)
> [ERROR] org.test.iPOJO.archtest.ArchTestImpl : null
> [ERROR] iPOJO Instance Creator : A matching factory was found for
> {component=org.test.iPOJO.archtest.ArchTestImpl, instance.name=archtest},
> but the instantiation failed : The configuration is not correct for the type
> org.test.iPOJO.archtest.ArchTestImpl : null
> 
> I think iPOJO is trying to add a new Architecture reference to the
> Architecture[] and call the bindArch() method of the component at the moment
> it is being created. Am I right? Am I doing something wrong here? Is it
> possible to do what I am trying to do?
> 
> Thanks in advance,
> Fabio
> 
> 
> 
> 
> --
> View this message in context: 
> http://apache-felix.18485.n6.nabble.com/Problem-when-creating-a-callback-bind-method-for-a-Architecture-field-injection-in-iPOJO-tp4998104.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