如何在部署 OSGI 包时修复缺失的需求
how to fix missing requirement while the deployment of an OSGI bundle
我正在尝试在 glassfish 4.1.1 中部署一个简单的 OSGI 包(hello world),但出现以下错误:
Infos: org.osgi.framework.BundleException:
Unresolved constraint in bundle com.mycompany.MavenHelloServiceImpl [324]:
Unable to resolve 324.0: missing requirement [324.0]
osgi.wiring.package; (osgi.wiring.package=com.mycompany.mavenhelloserviceapi)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
我不知道如何修复丢失的包,我已经将 "com.mycompany.mavenhelloserviceapi" 定义为捆绑包 MavenHelloServiceImpl 中的依赖项,它存在于捆绑包 MavenHelloServiceImpl 的依赖项文件夹中
知道如何修复此错误吗?!
将 com.mycompany.mavenhelloserviceapi
作为 pom.xml 中的依赖项是不够的:pom 是关于编译时依赖项的。您在此处看到有关缺少运行时依赖项的问题。
您应该在您的容器中安装 com.mycompany.mavenhelloserviceapi
。
您应该将包含 com.mycompany.mavenhelloserviceapi
的项目修改为捆绑项目,并显式导出此包。现在将此捆绑包与您的 hello world 捆绑包一起部署。
或者,您可以使用 Pax Wrap 将包含 com.mycompany.mavenhelloserviceapi
的 jar 部署到 glassfish,而无需修改项目。
我正在尝试在 glassfish 4.1.1 中部署一个简单的 OSGI 包(hello world),但出现以下错误:
Infos: org.osgi.framework.BundleException:
Unresolved constraint in bundle com.mycompany.MavenHelloServiceImpl [324]:
Unable to resolve 324.0: missing requirement [324.0]
osgi.wiring.package; (osgi.wiring.package=com.mycompany.mavenhelloserviceapi)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
我不知道如何修复丢失的包,我已经将 "com.mycompany.mavenhelloserviceapi" 定义为捆绑包 MavenHelloServiceImpl 中的依赖项,它存在于捆绑包 MavenHelloServiceImpl 的依赖项文件夹中 知道如何修复此错误吗?!
将 com.mycompany.mavenhelloserviceapi
作为 pom.xml 中的依赖项是不够的:pom 是关于编译时依赖项的。您在此处看到有关缺少运行时依赖项的问题。
您应该在您的容器中安装 com.mycompany.mavenhelloserviceapi
。
您应该将包含 com.mycompany.mavenhelloserviceapi
的项目修改为捆绑项目,并显式导出此包。现在将此捆绑包与您的 hello world 捆绑包一起部署。
或者,您可以使用 Pax Wrap 将包含 com.mycompany.mavenhelloserviceapi
的 jar 部署到 glassfish,而无需修改项目。