【问题标题】:<http> and <authentication-manager> tags are not working in spring security<http> 和 <authentication-manager> 标签在 Spring Security 中不起作用
【发布时间】:2014-06-08 06:28:55
【问题描述】:

我的spring security.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">
    <http auto-config="true"> 
        <intercept-url pattern="/admin**" access="ROLE_USER" /> 
    </http> 
    <authentication-manager>
        <authentication-provider>
            <user-service>
                <user name="suvajit" password="123456" authorities="ROLE_USER" />
            </user-service>
        </authentication-provider>
    </authentication-manager>
</beans:beans>

我正在使用

org.springframework.security.config-3.0.3.RELEASE.jar
org.springframework.security.core-3.0.3.RELEASE.jar
org.springframework.security.web-3.0.2.RELEASE.jar

为了弹簧安全..

它给了我编译错误

cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素'authentication-manager的声明

在这一行发现了多个注释:

  • schema_reference.4: 无法读取架构文档 'http://www.springframework.org/schema/security/ spring-security-3.2.xsd',因为
    1. 找不到文档;
    2. 无法读取文档;
    3. 文档的根元素不是 .
  • cvc-complex-type.2.4.c:匹配通配符是严格的,但找不到元素“http”的声明。

分别用于 authentication-manager 和 http 标签

请澄清我哪里错了

【问题讨论】:

    标签: spring spring-mvc spring-security


    【解决方案1】:

    你的罐子是

    • org.springframework.security.config-3.0.3.RELEASE.jar
    • org.springframework.security.core-3.0.3.RELEASE.jar
    • org.springframework.security.web-3.0.2.RELEASE.jar

    但是您的 xml 文档引用了 3.2 版 - 通过将您的 jar 升级到 3.2.3 RELEASE 版本来使它们兼容。

    【讨论】:

    • 嗨 NimChimpsky :: 我已经这样做了。我已将其更改为 3.0,反之亦然。我已经通过添加 3.2 jar 和 3.2 xsd 来尝试过这个。但这仍然不起作用..
    • springframework.org/schema/security/spring-security-3.0.xsd 我已经添加了这个来代替 3.2 xsd 但仍然无法正常工作
    • namespsace 3.2 适用于我引用的 jar 版本。也许你没有正确更新你的。你在用 maven,先做一个干净的构建。
    • 错误是非常具体的“找不到文档”编译器找不到参考/罐子。你确定你的类路径是正确的?你在用 maven 吗?
    • 我没有使用 maven.. 只是从 eclipse 创建这个项目.. 我的 jars 在我的项目目录中 web-inf 的 lib 文件夹中..
    猜你喜欢
    • 2012-03-07
    • 2018-08-23
    • 1970-01-01
    • 2016-10-15
    • 2017-05-26
    • 2016-11-13
    • 2014-09-13
    • 1970-01-01
    • 2014-08-31
    相关资源
    最近更新 更多