Eclipse 用の標準のbndtoolsプラグインをインストールし、apache felix osgi ランタイムを実行しています。宣言型サービス (DS) コンポーネントについて学習しようとしています。どうやら、アノテーション (bndtools のチュートリアルで例が示されています) が存在する前は、コンポーネントは xml データを使用して記述されていました。それが私がやろうとしていることです。
以下は単純なクラスです (DS コンポーネントとして公開されます): "HelloComponent.java"
package org.osgi.book.ds.minimal;
public class HelloComponent {
public HelloComponent(){
System.out.println("HelloComponent created.");
}
}
コンポーネント宣言を行う xml ファイルは次のとおりです: 「minimal.xml」
<?xml version="1.0" encoding="UTF-8"?>
<!-- minimal.xml -->
<scr:component xmlns:scr="http://www.osgi.org/xlmns/scr/v1.1.0" immediate="true">
<implementation class="org.osgi.book.ds.minimal.HelloComponent"/>
</scr:component>
そして、最終的に OSGi ランタイムに発行される jar ファイルを生成するために bndtools によって使用されることになっている .bnd ファイルは次のとおりです: "minimal_ds.bnd"
Private-Package: org.osgi.book.ds.minimal
Include-Resource: minimal.xml
Service-Component: minimal.xml
ホスト ランタイム OSGi コンテナーで次のバンドルを実行していることに注意してください。
ID|State |Level|Name
0|Active | 0|System Bundle (4.4.1)
2|Active | 1|Apache Felix Gogo Command (0.14.0)
3|Active | 1|Apache Felix Gogo Runtime (0.12.1)
4|Active | 1|Apache Felix Gogo Shell (0.10.0)
15|Active | 1|Apache Felix Configuration Admin Service (1.8.0)
16|Active | 1|Apache Felix Declarative Services (1.8.2)
17|Active | 1|osgi.enterprise (4.2.0.201003190513)
18|Active | 1|osgi.residential (4.3.0.201111022239)
最後に、プロジェクトのディレクトリ構造は次のとおりです。
BookReaderInPractice
|
|- src
| |- org.osgi.book.ds.minimal
| |_ HelloComponent.java
|
|- minimal_ds.bnd
|
|- minimal.xml
問題は、「mimimal」のバンドルをインストールしようとすると、要件が見つからないというエラーが発生することです。私が得る正確なエラーは次のとおりです。
missing requirement Require[osgi.extender]{}{filter=(&(osgi.extender=osgi.ds)(version>=1.1.0)(!(version>=2.0.0))), effective=active}]
Web 上の一部のリソースでは、これは bndtools の以前のバージョンのバグであると述べています。確かに、このパッケージをコンパイルして数日間問題なく実行できました。それから、ある時点で、それはちょうどそこで止まりました!プロジェクトを新しいEclipseワークスペースに完全にコピーするだけでなく、jarファイルを「再構築」、「再生成」しても何も機能していないようです。
これが私が使用しているものです:
OS-X 10.9 Maverics、Eclipse Luna Service Release 1 (4.4.1) BndTools: 2.4.1 (最新版)
誰かが手がかりを持っているようですか?