【发布时间】:2015-11-21 18:15:25
【问题描述】:
我正在编写一个 Spring MVC 项目。我有以下上下文 xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org.schema/context/spring-context-4.2.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="com.packt.webstore" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
这个 xml 有错误。错误信息是:
Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.springframework.org.schema/context/spring-
context-4.2.3.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the
document is not <xsd:schema>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element
'context:component-scan'.
jar 版本是
spring-webmvc-4.2.3
spring-context-4.2.3
spring-core-4.2.3
spring-web-4.2.3
spring-beans-4.2.3
spring-aop-4.2.3
spring-expression-4.2.3
有人可以帮我解决这个错误吗?
【问题讨论】:
标签: xml spring spring-mvc