[英]error when deploying jersey/helloworld-osgi-webapp on glassfish 3.1.2.2
尝试在以下位置部署样本jersey war捆绑代码(git上的helloworld-osgi-webapp: https : //github.com/jersey/jersey-1.x/tree/master/jersey/samples/helloworld-osgi-webapp )时Glassfish 3.1.2.2,出现以下osgi错误:
remote failure: Error occurred during deployment: Exception while loading the app:
org.osgi.framework.BundleException: Unresolved constraint in bundle war-bundle [344]:
Unable to resolve 344.0: missing requirement [344.0] osgi.wiring.package; (&(osgi.wiring.package=com.sun.jersey.api.core)(version>=1.18.0)(!(version>=2.0.0))).
Please see server.log for more details.
Command deploy failed
为什么Maven Felix插件没有在战争中嵌入库?
预先感谢,M。
直接的原因是在您的应用程序中未配置该功能,而在OSGi世界中则不应该这样做。
从pom来看,它在提供的范围内:
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<classifier>cobertura</classifier>
而且它只会嵌入运行时和编译范围:
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
并使用OSGi标准导入包将jersey-servlet依赖项作为OSGi服务导入:
<Import-Package>com.sun.jersey.api.core,com.sun.jersey.spi.container.servlet,*</Import-Package>
在OSGi世界中,依赖项应作为单独的OSGi捆绑软件部署,而不应嵌入战争中。 这就是您的示例正在做的事情。 因此,您应该将jersey部署为单独的OSGi捆绑包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.