Java 无法读取 spring.security 的架构文档
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23807375/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to read schema document of spring.security
提问by DarkCoffee
My spring-security.xml is
我的 spring-security.xml 是
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<http auto-config="true">
<intercept-url pattern="/admin**" access="ROLE_USER" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
When I start the server (Tomcat 7) inside Eclipse I get this error:
当我在 Eclipse 中启动服务器 (Tomcat 7) 时,出现此错误:
Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/security/spring-security-3.2.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .
忽略 XML 验证警告 org.xml.sax.SAXParseException:schema_reference.4:无法读取架构文档“ http://www.springframework.org/schema/security/spring-security-3.2.xsd”,因为 1) 无法找到文件;2) 无法读取文件;3) 文档的根元素不是 。
The libraries I've imported are:
我导入的库是:
commons-logging
公共日志记录
- jsp
- jstl
- spring-aop-4.0.4
- spring-beans-4.0.4
- spring-context-4.0.4
- spring-core-4.0.4
- spring-expression-4.0.4
- sprig-web-4.0.4
- spring-webmvc-4.0.4
- spring-security-core-3.2.4
- jsp
- jstl
- spring-aop-4.0.4
- spring-beans-4.0.4
- spring-context-4.0.4
- spring-core-4.0.4
- spring-expression-4.0.4
- sprig-web-4.0.4
- spring-webmvc-4.0.4
- spring-security-core-3.2.4
I believe there are some problems with the library version, but I'm not sure. I tried to search the version 4.0.4 but I haven't found it.
我相信库版本存在一些问题,但我不确定。我试图搜索版本 4.0.4 但我没有找到它。
Is the spring-security library included in another one? If yes, where can I look into when I need to know the unifications between the spring versions?
spring-security 库是否包含在另一个库中?如果是,当我需要知道 spring 版本之间的统一时,我可以在哪里查看?
How can I solve the error?
我该如何解决错误?
I googled all my questions but I haven't found anything.
我用谷歌搜索了我所有的问题,但我什么也没找到。
采纳答案by Andrei Stefan
Your xml file should start with something like this:
您的 xml 文件应以如下内容开头:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">
and the .xsd schemas are in spring-security-config
jar.
.xsd 模式在spring-security-config
jar 中。