user1985273
user1985273

Reputation: 1967

Unsatisfied OSGI component

I have an unsatisfied OSGI component and cant quite understand why that is so

My service definition looks like:

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
    immediate="true" enabled="true" name="MyService">
    <implementation class="com.example.MyService" />
    <reference name="HttpService" interface="org.osgi.service.http.HttpService"
        cardinality="1..1" policy="dynamic" bind="setHttpService" unbind="unsetHttpService" />
    <service>
        <provide interface="com.example.MyService" />
    </service>
</scr:component>  

and in my OSGI console i see:

osgi> comp 7
    Component[
    name = MyService
    activate = activate
    deactivate = deactivate
    modified = 
    configuration-policy = optional
    factory = null
    autoenable = true
    immediate = true
    implementation = com.example.MyService
    state = Unsatisfied
    properties = 
    serviceFactory = false
    serviceInterface = [com.example.MyService]
    references = {
        Reference[name = HttpService, interface = org.osgi.service.http.HttpService, policy = dynamic, cardinality = 1..1, target = null, bind = setHttpService, unbind = unsetHttpService]
    }
    located in bundle = com.example.MyService_1.00.0
]
Dynamic information :
  *The component is NOT satisfied
  The following references are not satisfied:
    Reference[name = HttpService, interface = org.osgi.service.http.HttpService, policy = dynamic, cardinality = 1..1, target = null, bind = setHttpService, unbind = unsetHttpService]
  Component configurations :
    Configuration properties:
      component.name = MyService
      component.id = 5
      objectClass = String[com.example.MyService]
    Instances:

osgi> 

What does this mean and how can i fix this?

Upvotes: 0

Views: 2423

Answers (3)

Neil Bartlett
Neil Bartlett

Reputation: 23958

Your component has a mandatory reference to the service org.osgi.service.http.HttpService. Apparently there is no HttpService available in the service registry. Therefore your component is not satisfied.

This could be fixed by installing an HttpService implementation, such as org.apache.felix.http.jetty. Documentation is available here.

Upvotes: 1

BJ Hargrave
BJ Hargrave

Reputation: 9384

Is there an org.osgi.service.http.HttpService service registered?

Upvotes: 0

Steve O
Steve O

Reputation: 40

You have "com.example.MyService" defined as both your implementation class and the interface.

Upvotes: -1

Related Questions