我使用 Apache Felix 来实现 osgi bundle 并将其用作嵌入式 Felix 框架来调用 boundle
这是我构建 MANIFEST.MF 的 Maven 插件:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Bundle-Activator>a.b.c.osgi.activator.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
我构建项目,然后像这样在嵌入的 felix 中使用 jar 文件
BundleContext bundleContext = f.getBundleContext();
Bundle bundle = bundleContext.installBundle(
"file:/home/eclipse_workSpace/my-module/target/abc-1.1.0.jar");)
String bName = bundle.getLocation();
bundle.getRegisteredServices();
bundle.getState();
/* Bundle[] bls = bundleContext.getBundles(); */
System.out.println("starting bundle " + bName);
bundle.start();
当我开始boundle时,我遇到了这个异常
线程“主”org.osgi.framework.BundleException 中的异常:无法解析 abc [1](R 1.0):缺少要求 [abc [1](R 1.0)] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=21.0.0)(!(version>=22.0.0))) 未解决的要求:[[abc [1](R 1.0) ] osgi.wiring.package; (&(osgi.wiring.package=com.google.common.base)(version>=21.0.0)(!(version>=22.0.0)))]
我应该怎么做才能解决这个问题?