0

「Greenpages app」は、Eclipse Virgo サイトで入手できるサンプル Web アプリケーションで、OSGI と Spring DM を一緒に使用する例を提供し、Virgo コンテナーにデプロイできます。http://www.eclipse.org/virgo/samples/を参照してください。エラーなしでアプリを実行できました。しかし、 org.springframework.osgi.context.event.OsgiBundleApplicationContextListenerインターフェースを実装しようとするとすぐに、すべてがうまくいかず、次のエラーが発生し始めます。

java.lang.IllegalArgumentException: 必要なプロパティ 'bundleContext' が設定されていません

OsgiBundleApplicationContextListener インターフェースは、BundleContext イベントをリッスンする方法を提供します。参照: http://docs.spring.io/osgi/docs/current/api/org/springframework/osgi/context/event/OsgiBundleApplicationContextListener.html

私のコード:

public class ApplicationContextObserver implements OsgiBundleApplicationContextListener { private transient int countRefreshed = 0; プライベート トランジェント int countClosed = 0;

public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent evt) {
    if(evt instanceof
            OsgiBundleContextRefreshedEvent) {
        countRefreshed++;
    } else if(evt instanceof
            OsgiBundleContextClosedEvent) {
        countClosed++;
    }
}
public int getCountRefreshed() {
    return countRefreshed;
}
public int getCountClosed() {
    return countClosed;
}

}

そして宣言された豆:

<bean id="ApplicationContextObserver" class="greenpages.ApplicationContextObserver" />
<osgi:service ref="ApplicationContextObserver" interface="org.springframework.osgi.context.event.OsgiBundleApplicationContextListener" />      

最悪の場合、このエラーがまったく表示されないことがありますが、コンテナーに別のバンドルをデプロイすると、リスナーが呼び出されません。

何がうまくいかないのですか (可能であれば、Virgo Container、SpringDM、およびこのリスナーを使用して実行中の例を添付できますか)?

4

1 に答える 1

0

Migrating from Spring Dynamic Modules to Eclipse Gemini Blueprint をご覧ください。詳細については、Eclipse Gemini ブループリント リファレンス ガイド(特にセクション8.3. Extender Configuration Options ) を参照してください。

于 2015-10-02T15:14:57.547 に答える