2012-03-20 46 views
1

我已经在我的dispatcher-servlet.xmlSpring MVC的3.1 - 命名空间的错误

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

XML验证失败之后说

无效的含量被发现与一个元素开始 '上下文:组件扫描'。 '{“http://www.springframework.org/schema/mvc":argument-resolvers,”http://www.springframework.org/ schema/mvc“:return-value-handlers}'之一。

我检查了在 http://www.springframework.org/schema/mvc/中定义的模式,一切似乎都没有问题。以前我使用Spring mvc 3.0,并没有遇到任何问题。我有我的所有jar文件直接在WEB-INF/lib。有任何想法吗?

更新

这是验证失败<context:component-scan base-package="com" />线路,是所有使用的罐子从春季3.1

+0

是3.1版的所有罐子吗? – Ralph 2012-03-20 16:16:35

+0

@skaffman:已更新问题以提供信息 – Raghav 2012-03-20 16:25:38

回答

4

可能是错的,但是看一下模式和错误定,你或许试图将<context:component-scan base-package="com" /> -element放在<mvc:annotation-driven> </mvc:annotation-driven>-标签内或忘记关闭<mvc:annotation-driven> -tag?将组件扫描放置在标签外或正确关闭<mvc:annotation-driven>标签。

+0

非常感谢。是的,我忘记关闭。傻我。我一直试图弄清楚问题出现了半个多小时。必须检查我的眼睛:P – Raghav 2012-03-20 16:46:24