【问题标题】:Spring Security XML can't find tag with error cvc-complex-type.2.4.cSpring Security XML 找不到带有错误 cvc-complex-type.2.4.c 的标签
【发布时间】:2013-04-15 13:53:32
【问题描述】:

我对 Spring Security 有疑问。 Eclipse 在 spring-security.xml 中找不到 html 标记并出现此错误:

Caused by: org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 28; cvc-complex-type.2.4.c : 
The matching wildcard is strict, but no declaration can be found for element 'http'

这里是xml

<?xml version="1.0" encoding="UTF-8"?>
<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.1.xsd
    http://www.springframework.org/schema/security
    http://www.springframework.org/schema/security/spring-security-3.1.xsd
">

  <http auto-config='true'>
    <intercept-url pattern="/**" access="ROLE_USER"/>
  </http>

  <authentication-manager>
    <authentication-provider>
      <user-service>
        <user name="user1" password="1111" authorities="ROLE_USER"/>
      </user-service>
    </authentication-provider>
  </authentication-manager>

</beans:beans>

问题出在第一个标签 html 上,但我找不到 xsd 配置的任何问题。

有什么想法吗?

非常感谢。

【问题讨论】:

  • 你确定是关于http标签吗?错误消息中的坐标指向上述 xml 中的pattern 值。您收到的完整错误消息是什么?
  • 这里是完整的错误信息:Caused by: org.xml.sax.SAXParseException;行号:12;列号:28; cvc-complex-type.2.4.c : Le caractère générique concordant est strict, mais aucune declaration ne peut être trouvée pour l'élément 'http'。对不起法国人!但是你可以看到http标签;)
  • 请检查 Spring jar 是否丢失,您使用的是 Maven 吗?
  • 是的,但实际上,maven 和 spring 安全性存在问题。当我放置依赖项时,我在一个有两个错误的视图上有一个错误。 The hierarchy of the type RepartitionExcelReportView is inconsistent 在类名上,The hierarchy of the type RepartitionExcelReportView is inconsistent 在父类上。我找不到任何解决方案,所以目前我将 jar 直接包含在构建路径中。
  • 好吧,我回来了这个版本,因为这里有一个问题。有什么想法可以纠正这些层次结构问题吗?

标签: xml spring security xsd


【解决方案1】:

您可能缺少找到所有 XSD 文件的 spring-security-config 依赖项。

如果它不在您的类路径中,请务必声明它:

<dependency>
  <groupId>org.springframework.security</groupId>
  <artifactId>spring-security-config</artifactId>
  <version>${spring-security.version}</version>
</dependency>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-10
    • 2011-11-20
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 2020-04-02
    • 1970-01-01
    相关资源
    最近更新 更多