以下是我spring-security.xml
的标题:
<?xml version="1.0" encoding="UTF-8" ?>
<b:beans xmlns:b="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/security/oauth2
http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd ">
启动服务器时,系统会提示我:
org.xml.sax.SAXParseException:schema_reference.4:无法读取 架构文件 'http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd', 因为1)找不到文件; 2)文件不可能 读; 3)文档的根元素不是&lt; xsd:schema /&gt;。
我对此的看法:
该链接有效且文档存在
我可以阅读它,如果我把这个xsd放在我的本地类路径上,我甚至可以重现这个错误。所以这不是一个网络问题。
没错,该文件以<xs:schema>
而不是<xsd:schema>
开头。但来源看起来合法。
为什么我会收到此错误,如何摆脱它?
答案 0 :(得分:3)
将所有架构位置更改为使用无版本的URI,这些XSD嵌入在Spring JAR中。
由于您使用的是XSD的版本化链接,如果在类路径上找不到该特定版本,您的应用程序就会中断。