我正在尝试使用本教程中概述的过程运行一个简单的应用程序:BndTools 教程项目。
这是我要加载的 osgi 项目/模块。
package com.counter;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
public class BundleCounterActivator implements BundleActivator,
BundleListener{
private BundleContext context;
public void start(BundleContext context) throws Exception{
this.context=context;
context.addBundleListener(this);
printBundleCount();
}
public void stop(BundleContext context)throws Exception{
context.removeBundleListener(this);
}
public void bundleChanged(BundleEvent event){
switch(event.getType()){
case BundleEvent.INSTALLED:
System.out.println("Bundle Installed");
printBundleCount();
break;
case BundleEvent.UNINSTALLED:
System.out.println("Bundle Uninstalled");
printBundleCount();
break;
}
}
private void printBundleCount(){
int count=context.getBundles().length;
System.out.println("There are currently" +count+ " bundles");
}
}
这是包含 BundleCounterActivator 类的包的 bnd.bnd 文件。
Bundle-Version: 0.0.0.${tstamp}
Private-Package: \
com.counter
Bundle-Activator: com.counter.BundleCounterActivator
我正在尝试将此捆绑包上传到教程中定义的“运行捆绑包”配置。但是,我收到以下错误:
Unable to resolve BundleCounter version=0.0.0.201508121544:
missing requirement Require[osgi.wiring.package]{}{filter=(&(osgi.wiring.package=org.osgi.framework)
我的问题:如何为这个项目安装缺少的包:'org.osgi.framework'(或者更确切地说,给定链接中教程项目的 felix osgi 运行时环境设置)?任何帮助表示赞赏。
以下是所涉及步骤的屏幕截图: