[英]Spring MVC 3.1 - Namespace error
I have the following in my dispatcher-servlet.xml
我在
dispatcher-servlet.xml
有以下内容
<?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">
The XML validation fails saying XML验证失败了
Invalid content was found starting with element 'context:component-scan'.
从元素'context:component-scan'开始发现无效内容。 One of '{"http://www.springframework.org/schema/mvc":argument-resolvers, "http://www.springframework.org/ schema/mvc":return-value-handlers}' is expected.
其中一个'{“http://www.springframework.org/schema/mvc":argument-resolvers,,http://www.springframework.org/ schema / mvc”:return-value-handlers}'是预期的。
I have checked the schemas defined in http://www.springframework.org/schema/mvc/
and everything seems to be fine. 我检查了
http://www.springframework.org/schema/mvc/
定义的模式,一切似乎都没问题。 Previously I was using Spring mvc 3.0 and it did not face any problem. 以前我使用的是Spring mvc 3.0,它没有遇到任何问题。 I have all my jar files directly in
WEB-INF/lib
. 我将所有jar文件直接放在
WEB-INF/lib
。 Any ideas? 有任何想法吗?
Update 更新
This is the line where the validation fails <context:component-scan base-package="com" />
and yes all the jars used are from Spring 3.1 这是验证失败的行
<context:component-scan base-package="com" />
是的,所有使用的jar都来自Spring 3.1
Could be wrong, but looking at the schemas and the error given, are you perhaps trying to place the <context:component-scan base-package="com" />
-element within <mvc:annotation-driven> </mvc:annotation-driven>
-tags or forgetting to close the <mvc:annotation-driven>
-tag? 可能是错的,但是查看模式和给出的错误,您是否可能尝试在
<mvc:annotation-driven> </mvc:annotation-driven>
放置<context:component-scan base-package="com" />
-element <mvc:annotation-driven> </mvc:annotation-driven>
-tags或忘记关闭<mvc:annotation-driven>
-tag? Place the component-scan outside the tags or close the <mvc:annotation-driven>
-tag properly. 将组件扫描放在标签外部或正确关闭
<mvc:annotation-driven>
-tag。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.