2013-10-18 5 views
1

난은 OSGi 선언적 서비스 구성 요소의 만족 기준에 문제가 있습니다신청이 만족되지 않음 참조

<?xml version="1.0" encoding="UTF-8"?> 
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" 
    name="com.mycompany.foo.Service" 
    immediate="true" 
    activate="activate" 
    deactivate="deactivate"> 
<implementation class="com.mycompany.foo.Service"/> 
<!-- Other references --> 
<reference 
     interface="org.osgi.service.http.HttpService" 
     name="HttpService" 
     cardinality="1..1" 
     policy="static" 
     bind="setHttpService" 
     unbind="unsetHttpService"/> 
</scr:component> 

내가 이클립스에서 OSGi 애플리케이션을 실행하고 콘솔 서비스가 Unsatisfied에 보여줍니다 상태 :

:

osgi> ls 
All Components: 
ID State   Component Name   Located in bundle 
6 Unsatisfied  com.mycompany.foo.Service   com.mycompany.foo(bid=18) 

comp 명령 보고서 이유는 org.osgi.service.http에 만족 참조입니다

osgi> comp 6 
Component[ 
    name = com.mycompany.foo.Service 
    ... 
    state = Unsatisfied 
    references = { 
     ... 
     Reference[name = HttpService, interface = org.osgi.service.http.HttpService, policy = static, cardinality = 1..1, target = null, bind = setHttpService, unbind = unsetHttpService] 
    } 
    located in bundle = com.mycompany.foo_1.2.3 [18] 
] 
Dynamic information : 
    *The component is NOT satisfied 
    The following references are not satisfied: 
    Reference[name = HttpService, interface = org.osgi.service.http.HttpService, policy = static, cardinality = 1..1, target = null, bind = setHttpService, unbind = unsetHttpService] 
    Component configurations : 
    Configuration properties: 
     component.name = com.mycompany.foo.Service 
     component.id = 6 
    Instances: 

그러나 org.osgi.service.httppackages 명령 쇼로 볼 수 있습니다 :

osgi> p org.osgi.service.http 
org.osgi.service.http; version="1.2.1"<org.eclipse.osgi.services_3.2.100.v20100503 [54]> 
    com.mycompany.foo_1.2.3 [18] imports 
    org.eclipse.equinox.http.registry_1.1.1.R36x_v20101103 [46] imports 
    org.eclipse.equinox.http.servlet_1.1.0.v20100503 [47] imports 
    org.eclipse.equinox.http.servletbridge_1.0.200.v20100503 [48] imports 

내가 서비스 문서에서 참조 및 인스턴스화 제대로 활성화되는 서비스 구성 요소를 제거하려고했으나 필수 HttpService 조각없이.

더 많은 문제를 해결하려면 도움을 주시면 감사하겠습니다.

답변

0

구성 요소에 HttpService 구현이 필요하다는 오류가 발생했습니다. 사용할 수있는 카드가 없습니다.

"p"명령은 정적 패키지에 대해서만보고합니다. 사용할 수있는 org.osgi.service.http API 패키지가 있지만 API를 실제로 구현하고 서비스를 제공하는 번들이 필요합니다.

사용하기 쉬운 HttpService 구현이 포함 된 org.apache.felix.http.jetty 번들을 추가하는 것이 좋습니다.

+0

감사합니다. 닐 감사합니다. 구현은'org.eclipse.equinox.http.servlet.internal.HttpServiceImpl'에 의해 가능해야합니다. – claudiopro

+0

번들 내부에있는 클래스의 이름입니다. 당신은 그것에 대해 신경 쓸 필요가 없습니다. 당신은 어떤 번들이 서비스를 제공하는지에 대해서만 관심을 보입니다. –

+0

내 작업 공간에 번들이 누락되었습니다. 필자의 프로젝트에서는 더 넓은 범위의 번들 리포지토리에서 최소한의 체리 피킹을 요구했습니다. 대상 플랫폼에는 원래 선택한 것보다 많은 번들이 필요했습니다. 이러한 상황에서 런타임 오류가 없다는 것은 의도적으로 설계된 것입니다. – claudiopro

관련 문제