【发布时间】:2015-04-17 19:23:06
【问题描述】:
我在 Eclipse 中创建了一个 OSGi Bundle 项目,我想从另一个 Java 项目以编程方式启动它。
这就是我想要做的:
FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator().next();
Map<String,String> config = new HashMap<String,String>();
Framework framework = frameworkFactory.newFramework(config);
framework.start();
BundleContext context = framework.getBundleContext();
Bundle bundle = context.installBundle("file:./test.ServiceA");
bundle.start();
但我有这个错误
Exception in thread "main" org.osgi.framework.BundleException: Error loading bundle activator.
...
Caused by: java.lang.ClassNotFoundException: test.servicea.Activator cannot be found by test.ServiceA_1.0.0.qualifier
如果我安装插件 jar 而不是指向文件夹,一切正常
Bundle bundle = context.installBundle("file:./tmp/test.ServiceA_1.0.0.201504172035.jar");
但我想直接调试Eclipse项目文件夹。
谁能帮帮我?
【问题讨论】: