If you want to reference a service which is exported in the same bundle, you 
have to put the optional flag.

Having said that I'm not too sure what you wanted to do in the blueprint below. 
The reference-list is intended to call a bean (or beans) when the desired 
services match and disappear. In other words it behaves as a kind of service 
tracker.

Here is a basic example:

<bean id="myBean" class="..."/>

<reference-list interface="FULLJAVAINTERFACENAME" availability="optional">
<reference-listener ref="myBean" bind-method="serviceFound" 
unbind-method="serviceLost"/>
</reference-list>

Where myBean would contain two public methods serviceFound and serviceLost. 
Also note that serviceLost method would be called with a null service if no 
service was found during startup, as per enterprise spec section 121.7.12.

JP

[@@ OPEN @@]

De : Leschke, Scott [mailto:[email protected]]
Envoyé : jeudi 12 février 2015 23:20
À : [email protected]
Objet : RE: Blueprint GracePeriod issue

OK, if I understand you correctly, and I think I do since my test seems to bear 
that out, the bundle was going into GRACEPERIOD because there wasn't a service 
defined that implemented the exported service interface, hence the service 
injection can't work (which is what's happening, well sort of).  That explains 
why it used to work but began not working, since I simply wasn't deploying 
everything.

What confuses me a bit is that in this case, the lines in the blueprint.xml 
that seems to be causing the issue is the following:

<bean id="service-controller-impl"
       class="com.medline.bam.MyTestServiceController">

       <!-- Service constructor args -->
<argument ref="service-list"/>
</bean>

<reference-list id="service-list"
              member-type="service-object"
              interface="com.medline.bam.MyTestService"/>

It confuses me since the injection is of type List<MyTestService>.  Since this 
list is "live" in the sense that entries can come and go at any time, shouldn't 
the injection of the list still succeed, but the list is empty, wouldn't that 
have made sense?  Perhaps there's a good reason why Blueprint isn't defined 
this way, I'd be curious as to what that reason is.

Thanks,

Scott

From: Benjamin Debeerst [mailto:[email protected]]
Sent: Thursday, February 12, 2015 1:06 PM
To: [email protected]<mailto:[email protected]>
Subject: RE: Blueprint GracePeriod issue

Hi Scott,

I find that kind of diagnosis from Blueprint quite confusing as well, because 
Blueprint tends to mix up dependencies on the bundle layer and dependencies on 
the service layer.

The bundle is resolved and started, but the blueprint container/component is 
missing service dependencies, in particular it cannot find a service with the 
given interface in the OSGi service registry. This is why it cannot start the 
blueprint component/container and is in the grace period state.

Do you have some component exposing the interface in question as a service in 
the OSGi service registry?

Regards,
Benjamin

From: Leschke, Scott [mailto:[email protected]]
Sent: Donnerstag, 12. Februar 2015 19:14
To: [email protected]<mailto:[email protected]>
Subject: Blueprint GracePeriod issue

I have a bundle going into GracePeriod state.  The bundle:diag command says 
Missing Dependencies and gives me the name of an interface that exists in the 
bundle itself.  Is this indicative of a particular type of condition? I find it 
odd that it's complaining about not finding an interface that exists locally.

Reply via email to