Hello

The problem MAY be because your @Reference was processed by
maven-bundle-plugin (with _dsannotations configuration) or maven-scr-plugin
- or any plugin processing DS/SCR annotations and you ended with
"Require-Capability" or "Import-Service" MANIFEST.MF header.

What I usually (always) do is (in maven-bundle-plugin configuration):

<_removeheaders>Import-Service,Require-Capability</_removeheaders>

(see documentation here:
https://bnd.bndtools.org/instructions/removeheaders.html)

Karaf feature resolver takes these headers into account and, because your
service may not (yet) be available), you may have resolution problem.

regards
Grzegorz Grzybek

śr., 29 kwi 2020 o 12:41 braus <s.bra...@gaston-schul.com> napisał(a):

> 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