2013-10-07 31 views
11

我已經添加了spring-security-config-3.1.0.RC3 .jar在我的lib文件夾中,我仍然得到這個錯誤。什麼可能是可能的原因?cvc-complex-type.2.4.c:匹配通配符是嚴格的,但是對元素'mvc:annotation-driven'錯誤沒有聲明

這裏是我的調度員servlet.xml中

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xsi:schemaLocation=" 
    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"> 

    <context:component-scan base-package="com.tcs.rspm.controller" /> 
<mvc:annotation-driven /> 
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
     <property name="prefix" value="/webpages/" /> 
     <property name="suffix" value=".jsp" /> 
    </bean> 

</beans> 

回答

29

你有這樣的:

xmlns:mvc="http://www.springframework.org/schema/mvc" 

,但你不能在這裏提到它:

xsi:schemaLocation=" 
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/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 

有作爲,像

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"> 

注:它實際上是常見的架構引用不提Spring版本,以便更容易升級,所以你可以使用引用喜歡http://www.springframework.org/schema/context/spring-context.xsd爲好。

相關問題