2014-07-18 44 views
1

我想將Spring MVC Web應用程序部署到Sling OSGi容器。我遵循本指南 http://www.jasonday.net/content/running-spring-mvc-sling#configure-slingdispatcherservlet-sling-aware解決Sling OSGi容器中的依賴關係錯誤

但是,當我將jar文件部署到Sling OSGi Container時,我的包不是'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) 

我應該怎麼做才能安裝吊索OSGi容器這些依賴?請給我一些關於這個問題的建議。

回答

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。