我想将Spring MVC Web应用程序部署到Sling OSGi Container。我按照本指南 http://www.jasonday.net/content/running-spring-mvc-sling#configure-slingdispatcherservlet-sling-aware。
但是当我将jar文件部署到Sling OSGi Container时,我的bundle不是'Active'(它只是'Installed')而且我发现根本原因是某些依赖关系没有得到解决。
javax.annotation,version=[1.0,2) -- Cannot be resolved
javax.inject,version=[1.0,2) -- Cannot be resolved
net.sf.cglib.beans,version=[2.2,3) -- Cannot be resolved
net.sf.cglib.core,version=[2.2,3) -- Cannot be resolved
net.sf.cglib.proxy,version=[2.2,3) -- Cannot be resolved
net.sf.cglib.reflect,version=[2.2,3) -- Cannot be resolved
net.sf.cglib.transform,version=[2.2,3) -- Cannot be resolved
net.sf.cglib.transform.impl,version=[2.2,3) -- Cannot be resolved
net.sf.cglib.util,version=[2.2,3) -- Cannot be resolved
org.aopalliance.aop,version=[1.0,2) -- Cannot be resolved
org.aopalliance.intercept,version=[1.0,2) -- Cannot be resolved
org.apache.commons.codec,version=[1.5,2) -- Cannot be resolved
org.apache.commons.codec.binary,version=[1.5,2) -- Cannot be resolved
org.apache.commons.lang,version=[2.6,3) -- Cannot be resolved
org.apache.commons.lang.builder,version=[2.6,3) -- Cannot be resolved
org.apache.commons.lang.math,version=[2.6,3) -- Cannot be resolved
org.apache.commons.lang.time,version=[2.6,3) -- Cannot be resolved
org.aspectj.lang,version=[1.6,2) -- Cannot be resolved
org.aspectj.lang.annotation,version=[1.6,2) -- Cannot be resolved
org.objectweb.asm,version=[3.2,4) -- Cannot be resolved
org.objectweb.asm.signature,version=[3.2,4) -- Cannot be resolved
org.springframework.aop,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.aspectj,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.aspectj.annotation,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.aspectj.autoproxy,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.config,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.framework,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.framework.adapter,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.framework.autoproxy,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.framework.autoproxy.target,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.interceptor,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.scope,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.support,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.support.annotation,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.target,version=[3.0,4) -- Cannot be resolved
org.springframework.aop.target.dynamic,version=[3.0,4) -- Cannot be resolved
org.springframework.beans,version=[3.0,4) -- Cannot be resolved
org.springframework.beans.factory,version=[3.0,4) -- Cannot be resolved
org.springframework.beans.factory.annotation,version=[3.0,4) -- Cannot be resolved
org.springframework.beans.factory.config,version=[3.0,4) -- Cannot be resolved
org.springframework.context,version=[3.0,4) -- Cannot be resolved
org.springframework.context.annotation,version=[3.0,4) -- Cannot be resolved
org.springframework.context.support,version=[3.0,4) -- Cannot be resolved
org.springframework.core,version=[3.0,4) -- Cannot be resolved
org.springframework.core.io,version=[3.0,4) -- Cannot be resolved
org.springframework.expression,version=[3.0,4) -- Cannot be resolved
org.springframework.osgi.extensions.annotation,version=[1.2,2) -- Cannot be resolved
org.springframework.osgi.web.context.support,version=[1.2,2) -- Cannot be resolved
org.springframework.stereotype,version=[3.0,4) -- Cannot be resolved
org.springframework.util,version=[3.0,4) -- Cannot be resolved
org.springframework.web.bind.annotation,version=[3.0,4) -- Cannot be resolved
org.springframework.web.bind.support,version=[3.0,4) -- Cannot be resolved
org.springframework.web.context,version=[3.0,4) -- Cannot be resolved
org.springframework.web.context.request,version=[3.0,4) -- Cannot be resolved
org.springframework.web.context.support,version=[3.0,4) -- Cannot be resolved
org.springframework.web.servlet,version=[3.0,4) -- Cannot be resolved
org.springframework.web.servlet.handler,version=[3.0,4) -- Cannot be resolved
org.springframework.web.servlet.mvc.annotation,version=[3.0,4) -- Cannot be resolved
org.springframework.web.util,version=[3.0,4) -- Cannot be resolved
在控制台中我看到了这个错误:
ERROR: Bundle net.jasonday.examples.sling.spring.mvc [79]: Error starting/stopping bundle. (org.osgi.framework.BundleException: Unresolved constraint in bundle
net.jasonday.examples.sling.spring.mvc [79]: Unable to resolve 79.0: missing requirement [79.0] package; (&(package=javax.annotation)(version>=1.0.0)(!(version>
=2.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle net.jasonday.examples.sling.spring.mvc [79]: Unable to resolve 79.0: missing requirement [79
.0] package; (&(package=javax.annotation)(version>=1.0.0)(!(version>=2.0.0)))
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3443)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1727)
at org.apache.felix.framework.Felix.setBundleStartLevel(Felix.java:1333)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:270)
at java.lang.Thread.run(Thread.java:662)
如何在Sling OSGi Container中安装这些依赖项?请就这个问题给我一些建议。
答案 0 :(得分:2)
第二条错误消息表示您的net.jasonday.examples.sling.spring.mvc
捆绑包需要javax.annotation
包,版本> = 1.0.0且< 2.0.0,并且该包不会在您的Sling实例中导出。
IMO使这个包可用的最好方法是安装一个片段包,将其添加到系统包的包导出中。我不认为我们在Sling中有这样的片段包,但您可以以framework-extension-activation包作为示例创建一个。
阅读您发布的第一条错误消息,似乎您也错过了很多其他捆绑包,您可以通过/ system / console / bundles安装它们,或者只是将它们复制到Sling内容存储库中如果Sling OSGi installer处于活动状态,则名为/ apps / yourapp / install的文件夹。