我已經使用激活器創建了一個包。在啓動我的包時,激活方法應該被調用,但它們不是。我已經按照教程中提到的相同方式實現了它。未在OSGi中收到通知的BundleActivator方法
package com.manning.sdmia;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private BundleContext context;
public void start(BundleContext context) throws Exception {
System.out.println("In bundle");
}
public void stop(BundleContext context) throws Exception {
System.out.println("In stop");
}
}
這是我MANIFEST.MF
文件:
enter code here
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Spring DM Hello World
Bundle-SymbolicName: com.manning.sdmia.helloworld
Bundle-Version:1.0.0
Bundle-Activator: com.manning.sdmia.Activator
Export-Package:com.manning.sdmia
Import-Package: org.osgi.framework
現在,當我開始從一開始的命令System.out.println
的OSGI提示捆應該得到呼籲啓動,但它不打印任何東西。
我看不出什麼毛病,你迄今發佈的內容。你能否添加你在shell中輸入的內容以及輸出是什麼?有沒有任何錯誤信息? – 2012-07-11 14:51:41
是的,請添加更多的細節。你可以驗證捆綁正在運行嗎? – ilikeorangutans 2012-07-12 03:30:29
是的。請添加更多的細節。您是使用IDE來運行您的OSGi環境還是僅通過控制檯啓動您的框架?順便說一句,你使用哪個框架? – 2012-07-17 16:26:56