Hello everyone,

So I'm not sure if I found a bug or I did something wrong.

Issue description:
I try to install a bundle which has a reference to a service which is not on
the karaf at installation time. The bundle fails to install.

Expected situation:
When installing a bundle which has a reference to a service which is not
there yet the bundle should be in an inactive state (installed state I
guess?). When the service is available the inactive bundle should take the
service and go into the active state.

Workaround:
Configuring the service like:
    @Reference(cardinality = ReferenceCardinality.OPTIONAL,
            policyOption = ReferencePolicyOption.GREEDY)

The drawback of this is that the bundle should be in an inactive state if
the service cannot be found. With this configuration however the bundle will
be active regardless.

Steps to reproduce: Have a bundle with a component like:
@Component(service = AnService.class

If used over DOSGI you can add to the class:
property = {
        "service.exported.interfaces=*"
})

Then in a different bundle use:
    @Reference
    AnService anService;


Versions used: 
Karaf 4.3.0.RC1
OSGI annotations: 7.0.0





--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Reply via email to