Jer
Jer

Reputation: 113

Why is my Karaf OSGI bundle marked UNSATISFIED, when all references are satisfied?

Karaf is showing my bundle as being UNSATISFIED despite all the references being satisfied.

I am using the following three components - relevant console output from scr:list:

[20  ] [UNSATISFIED     ] com.barchart.news.modules.mysql.MySQLIndex
[16  ] [ACTIVE          ] com.barchart.news.server.pipeline.StoryPipeline
[14  ] [ACTIVE          ] com.barchart.news.server.common.SharedExecutorProvider

Components 16 and 14 provide the following services (output from service:list):

service:list com.barchart.news.server.pipeline.PipelineService
[com.barchart.news.server.common.ModuleStatus, com.barchart.news.server.pipeline.PipelineService]
-------------------------------------------------------------------------------------------------
 component.name = com.barchart.news.server.pipeline.StoryPipeline
 component.id = 16
 service.id = 348
Provided by : 
 barchart-news-server (102)

service:list com.barchart.news.server.common.SharedExecutorService 
[com.barchart.news.server.common.ModuleStatus, com.barchart.news.server.common.SharedExecutorService]
-----------------------------------------------------------------------------------------------------
 component.name = com.barchart.news.server.common.SharedExecutorProvider
 component.id = 14
 service.id = 346
Provided by : 
 barchart-news-server (102)
Used by: 
 barchart-news-server (102)

Within the barchart-news-server bundle that these both are part of, references are satisfied and bound as expected (output from scr:details):

scr:details com.barchart.news.server.pipeline.StoryPipeline
Component Details
  Name                : com.barchart.news.server.pipeline.StoryPipeline
  State               : ACTIVE
References
  Reference           : com.barchart.news.server.common.SharedExecutorService/*
    State             : satisfied
    Multiple          : single
    Optional          : mandatory
    Policy            : static
    Service Reference : Bound Service ID 346 (com.barchart.news.server.common.SharedExecutorProvider)

However, in the component from the second bundle (#20) that depends on these services, although Karaf marks the references as "satisfied", it does not bind them and activate the component:

scr:details for com.barchart.news.modules.mysql.MySQLIndex:

Component Details
  Name                : com.barchart.news.modules.mysql.MySQLIndex
  State               : UNSATISFIED
References
  Reference           : com.barchart.news.server.common.SharedExecutorService/*
    State             : satisfied
    Multiple          : single
    Optional          : mandatory
    Policy            : static
    Service Reference : No Services bound
  Reference           : com.barchart.news.server.pipeline.PipelineService/*
    State             : satisfied
    Multiple          : single
    Optional          : mandatory
    Policy            : static
    Service Reference : No Services bound

What is preventing the MySQLIndex bundle from being activated?

Upvotes: 3

Views: 5226

Answers (1)

Björn Pollex
Björn Pollex

Reputation: 76778

If I read this correctly, then your problem is not an unsatisfied bundle, but an unsatisfied service. If it so far that the SCR picked up your service, then your bundle must already be active.

With declarative services, I have seen similar behavior when a service with configuration-policy=require is missing a configuration. Another possibility is that the activate-method threw an exception.

Upvotes: 2

Related Questions