I think what happens is that blueprint starts up, wires the optional refrence, then calls the factory which results in a NPE.
Maybe this error is then just not reported correctly.

Try to do a try catch in the factory that uses the reference to the service and log if there is an exception.

Christian

Am 18.09.2015 um 12:33 schrieb CLEMENT Jean-Philippe:

I understand. The problem is the bundle (A) is failing to start. I do not get a null object.

I don’t know why it was always working perfectly and now not working at all.

Regards,

JP

[@@ OPEN @@]

*De :*Christian Schneider [mailto:[email protected]] *De la part de* Christian Schneider
*Envoyé :* vendredi 18 septembre 2015 12:27
*À :* [email protected]
*Objet :* Re: Karaf upgrade 3.0.2 -> 4.0.1 leads to ServiceUnavailableException

Blueprint does not do service damping on optional services. So if you refer the service in your bean you have to cope with it being null. You might use the callback blueprint offers when the service gets registered.

Christian

On 18.09.2015 10:38, CLEMENT Jean-Philippe wrote:

    Dear Karaf,

    I upgraded Karaf version from 3.0.2 to 4.0.1 and obtained a
    ServiceUnavailbleException from one of our bundles – which was
    working fine with the former version of Karaf.

    I must first say that services registering/retrieval implied in
    this issue are not made in a clean way as they imply kind of
    circular dependencies. But it was working fine with Karaf 3.0.2.
    Those services are registered and retrieved using Blueprint.

    We have a bundle A which exports base services which are used by a
    bundle B. Bundle B will use those base services and will export
    higher added value ones. One of B services are used by A. This
    service reference (A) is set as optional.

    I don’t know whether Karaf 3.0.2 was accepting something wrong
    which was corrected in 4.0.1, if it’s a 4.0.1 bug, or maybe just a
    behavior difference which may be configured somewhere.

    Maybe first, is the starting scenario correct (even if not
    recommended)?

    Thank you,

    JP

    [@@ OPEN @@]




--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com

Reply via email to