【发布时间】:2015-08-11 23:04:43
【问题描述】:
我正在使用 spring,但遇到了问题
我的servlet-config.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" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<mvc:annotation-driven/>
<context:component-scan base-package="somepackage"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
</beans>
例外
org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 122; cvc-elt.1: Cannot find the declaration of element 'beans'.
第 6 行是http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
我已经搜索了很多类似的问题并尝试了它们,但效果很好。
我已经检查了我的互联网连接,还尝试通过删除版本号来转换网址,但仍然有效。
我不想下载并在本地存储这些 xsd 文件,但如果我的连接正常,为什么我会遇到这个问题,我也尝试清理 eclipse 缓存
谁能帮帮我?
@Jens 之后我的项目工作了,但 IDE 显示如下所示的一些错误
在这一行发现多个注释:
- schema_reference.4:无法读取架构文档“http://www.springframework.org/schema/context/spring-context.xsd”,
因为 1) 找不到文件; 2) 文件不能
被阅读; 3) 文档的根元素不是。- cvc-complex-type.2.4.c:匹配通配符是严格的,但找不到元素“context:component-scan”的声明。
【问题讨论】:
标签: java xml spring spring-mvc xsd