I don't have a way to reproduce it.

When the system runs on our tests system and when it first started all
components were bound correctly. However we had a production issue and
we wanted to remove a component (delete the xxx.cfg file)  when we added
it back later, that component appeared as null to @Bind causing them to
fail as we hadn't written our code to expect a null value on a bind. (No
code was changed)

We are able to change the code to not blow up when a null is passed but
cannot get much further than that.  I imagine the problem will go away
for we restart the system but it would be good investigate it as far as
we can before doing that. I will change the component to inspect the
array as well.

-----Original Message-----
From: Clement Escoffier [mailto:[email protected]] 
Sent: 19 January 2011 14:30
To: Apache Felix - Users Mailing List
Subject: Re: @Bind method is passed a null value.

Hi,

On 19.01.11 12:59, "peter lawrey" <[email protected]> wrote:

>We are using iPOJO 1.6.2 and I have a method as follows. Is this a
valid
>combination of options as I am getting a null value passed to it when a
>ClockSubscriber is added. (At startup they were added fine, but when I
>remove&add back a component it is always null)

Definitely weird.

Could you try, to remove the @Requires and to populate the array/list
yourself from the bind?
Are you sure that your bundle can get the service (classloading), i.e.
Make sure it's importing the service interface and the providers are
also
importing it ?

Anyway, I'd like to have an in-depth view (iPOJO should say something in
this case), do you have a way to reproduce the issue easily?

Regards,

Clement



>
> 
>
>@Requires)optional = true, id = "subscribers")
>
>private ClockSubscriber[] subscribers;
>
> 
>
>@Bind(aggregate = true, id = "subscribers", optional = true)
>
>public void subscriberBound(ClockSubscriber subscriber) {
>
>    try {
>
>        if(subscriber == null) throw new NullPointerException();
>
> 
>
>And this exception
>
> 
>
>java.lang.NullPointerException
>
>        at
>com.edgeci.patch.ClockManager2.__subscriberBound(ClockManager2.java:153
)
>
>        at
>com.edgeci.patch.ClockManager2.subscriberBound(ClockManager2.java)
>
>        at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown
Source)
>
>        at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
r
>Impl.java:25)
>
>        at java.lang.reflect.Method.invoke(Method.java:597)
>
>        at org.apache.felix.ipojo.util.Callback.call(Callback.java:235)
>
>        at
>org.apache.felix.ipojo.handlers.dependency.DependencyCallback.call(Depe
n
>dencyCallback.java:239)
>
>        at
>org.apache.felix.ipojo.handlers.dependency.Dependency.invokeCallback(De
p
>endency.java:288)
>
>        at
>org.apache.felix.ipojo.handlers.dependency.Dependency.callBindMethod(De
p
>endency.java:330)
>
>        at
>org.apache.felix.ipojo.handlers.dependency.Dependency.onServiceArrival(
D
>ependency.java:445)
>
>        at
>org.apache.felix.ipojo.util.DependencyModel.manageArrival(DependencyMod
e
>l.java:392)
>
>        at
>org.apache.felix.ipojo.util.DependencyModel.addedService(DependencyMode
l
>.java:335)
>
>        at
>org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:72
5
>)
>
>        at
>org.apache.felix.ipojo.util.Tracker$Tracked.track(Tracker.java:686)
>
>        at
>org.apache.felix.ipojo.util.Tracker$Tracked.serviceChanged(Tracker.java
:
>647)
>
>        at
>org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCa
l
>lback(EventDispatcher.java:878)
>
>        at
>org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(Ev
e
>ntDispatcher.java:732)
>
>        at
>org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventD
i
>spatcher.java:662)
>
>        at
>org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3603)
>
>        at org.apache.felix.framework.Felix.access$000(Felix.java:40)
>
>        at
>org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:624)
>
>        at
>org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegis
t
>ry.java:90)
>
>        at
>org.apache.felix.framework.Felix.registerService(Felix.java:2716)
>
>        at
>org.apache.felix.framework.BundleContextImpl.registerService(BundleCont
e
>xtImpl.java:252)
>
>        at
>org.apache.felix.ipojo.IPojoContext.registerService(IPojoContext.java:3
3
>8)
>
>        at
>org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registe
r
>Service(ProvidedService.java:339)
>
>        at
>org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.
_
>_stateChanged(ProvidedServiceHandler.java:489)
>
>        at
>org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.
s
>tateChanged(ProvidedServiceHandler.java)
>
>        at
>org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:44
1
>)
>
>        at
>org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:322)
>
>        at
>org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory
.
>java:155)
>
>        at
>org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactor
y
>.java:301)
>
>        at
>org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactor
y
>.java:238)
>
>        at
>org.apache.felix.ipojo.IPojoFactory.updated(IPojoFactory.java:625)
>
>        at
>org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(C
o
>nfigurationManager.java:1460)
>
>        at
>org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88)
>



---------------------------------------------------------------------
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