You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Leschke, Scott" <SL...@medline.com> on 2015/02/12 19:14:07 UTC

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.

RE: Blueprint GracePeriod issue

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
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:SLeschke@medline.com]
Envoyé : jeudi 12 février 2015 23:20
À : user@karaf.apache.org
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:Benjamin.Debeerst@younicos.com]
Sent: Thursday, February 12, 2015 1:06 PM
To: user@karaf.apache.org<ma...@karaf.apache.org>
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:SLeschke@medline.com]
Sent: Donnerstag, 12. Februar 2015 19:14
To: user@karaf.apache.org<ma...@karaf.apache.org>
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.

RE: Blueprint GracePeriod issue

Posted by "Leschke, Scott" <SL...@medline.com>.
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:Benjamin.Debeerst@younicos.com]
Sent: Thursday, February 12, 2015 1:06 PM
To: user@karaf.apache.org
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:SLeschke@medline.com]
Sent: Donnerstag, 12. Februar 2015 19:14
To: user@karaf.apache.org<ma...@karaf.apache.org>
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.

Re: Blueprint GracePeriod issue

Posted by David Bosschaert <da...@gmail.com>.
I think the service dependency to a service published by the same
blueprint container will work if that dependency is marked optional.
Basically the problem is that Blueprint will not initialize its
component if the mandatory dependencies aren't available. If you make
that dependency optional you should get injected with the service
dependency from your own bundle...

On 12 February 2015 at 20:12, Achim Nierbeck <bc...@googlemail.com> wrote:
> Hi,
>
> if you try to reference a service which you published through the same
> blueprint, this will fail.
> You should use the bean instead then.
>
> regards, Achim
>
>
> 2015-02-12 20:06 GMT+01:00 Benjamin Debeerst
> <Be...@younicos.com>:
>>
>> 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:SLeschke@medline.com]
>> Sent: Donnerstag, 12. Februar 2015 19:14
>> To: user@karaf.apache.org
>> 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.
>
>
>
>
> --
>
> Apache Member
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> blog <http://notizblog.nierbeck.de/>
> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>
> Software Architect / Project Manager / Scrum Master
>

Re: Blueprint GracePeriod issue

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

if you try to reference a service which you published through the same
blueprint, this will fail.
You should use the bean instead then.

regards, Achim


2015-02-12 20:06 GMT+01:00 Benjamin Debeerst <Benjamin.Debeerst@younicos.com
>:

>  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:SLeschke@medline.com]
> *Sent:* Donnerstag, 12. Februar 2015 19:14
> *To:* user@karaf.apache.org
> *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.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

RE: Blueprint GracePeriod issue

Posted by Benjamin Debeerst <Be...@younicos.com>.
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:SLeschke@medline.com]
Sent: Donnerstag, 12. Februar 2015 19:14
To: user@karaf.apache.org
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.