I'm facing an issue in OSGi context with declarative services which I don't understand. I try to explain:
I have a FooService
which needs the FooManagerService (1..1 static)
. The FooManagerService
references the FooService
, but it's optional (0..n dynamic)
.
The goal is, if a FooService
becomes available, it registers (bind()
method is called) at the FooManagerService
, so that the FooManagerService
always has a list of all available FooService
implementations in the system.
It works well on Windows, but on Linux I encounter the problem, that the FooService
becomes active (activate()
method is called), but that isn't recognized by the FooManagerService
(bind()
method isn't called). If I disable and enable FooService
manually on the OSGi console, it is recognized by the FooManagerService
.
I don't understand, why this happens. It can be avoided, by increasing the start level of the bundle, where FooServiceImpl
is located. But that feels like an ugly workaround for, that's why I would like to understand what's going on there.
I attach a picture which describes the references between the services. Any hint is appreciated. Thanks in advance!
Best regards
Steffi