2012-04-15 81 views
13

我有一個運行在日食virgo OSGi平臺上的spring MVC projet。 當我嘗試使用<osgi:reference>標籤我得到下面的異常導入OSGi服務:Spring無法找到OSGi名稱空間處理程序

Servlet /Web threw load() exception org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/osgi] 

這是我的應用程序上下文文件:

<?xml version="1.0" encoding="UTF-8"?> 
<beans:beans xmlns="http://www.springframework.org/schema/mvc" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:beans="http://www.springframework.org/schema/beans" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:osgi="http://www.springframework.org/schema/osgi" 
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 
    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> 


<annotation-driven /> 


<resources mapping="/resources/**" location="/resources/" /> 


<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <beans:property name="prefix" value="/WEB-INF/views/" /> 
    <beans:property name="suffix" value=".jsp" /> 
</beans:bean> 

<context:component-scan base-package="com.apptivit.web" /> 

<osgi:reference id="entityService" interface="com.apptivit.db.service.AbstractEntityService"/> 
</beans:beans> 

最後,在我的MANIFEST.MF文件,我這樣做:

Manifest-Version: 1.0 
Export-Package: com.apptivit.web;uses:="org.springframework.stereotype 
,org.springframework.ui,org.springframework.web.bind.annotation" 
Tool: Bundlor 1.0.0.RELEASE 
Import-Package: com.apptivit.db.service, 
org.apache.log4j, 
org.slf4j, 
org.springframework.context;version="[3.0.5.RELEASE,3.0.5.RELEASE]", 
org.springframework.stereotype, 
org.springframework.ui, 
org.springframework.web.bind.annotation, 
org.springframework.web.context, 
org.springframework.web.servlet, 
org.springframework.web.servlet.view 
Bundle-SymbolicName: webs 
Bundle-Version: 0.0.1 
Bundle-Name: WebSample 
Bundle-Vendor: ApptivIT 
Import-Bundle: org.springframework.osgi.core;version="[1.2.1,1.2.1]", 
org.springframework.beans;version="[3.0.5.RELEASE,3.0.5.RELEASE]", 
org.springframework.core;version="[3.0.5.RELEASE,3.0.5.RELEASE]" 

我在做什麼錯?

+3

我不明白爲什麼這個問題被低估了... – 2012-04-18 09:17:14

+0

我也是。沒有人給我答覆,我仍然沒有解決方案:( – 2012-04-18 12:21:04

+0

@HoucemBerrayana,這個問題發佈了一年多前,你解決了這個問題嗎?如果是這樣,你能分享你是如何做到的嗎?需要命名空間解析器http://www.springframework.org/schema/osgi? – 2013-09-27 17:22:17

回答

0

我懷疑你需要導入org.springframework.osgi.core,所以請嘗試刪除該導入。

xsi:schemaLocation= 
http://www.springframework.org/schema/osgi/spring-osgi.xsd" 

到:

+0

這並不能解決問題。我多次遇到這個問題,並且總是與丟失的罐子有關。但是這次我不明白我做錯了什麼。 – 2012-04-21 09:26:55

0

嘗試從改變

xsi:schemaLocation= 
http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd 

錯誤顯示您的OSGi schemaLocation是錯誤的。

相關問題