Spring Security XML错误-cvc-complex-type.2.4.a:发现无效的内容(从元素“ csrf”开始)

Pankaj Bhambhani

我在我的Web应用程序项目中使用Spring Security。我想在我的Spring应用程序中启用csrf保护。我的application-context-security.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.0.xsd
                        http://www.springframework.org/schema/security
                         http://www.springframework.org/schema/security/spring-security-3.0.xsd">

    <global-method-security secured-annotations="enabled"/> 

    <http disable-url-rewriting="true" auto-config="false" access-decision-manager-ref="accessDecisionManager" entry-point-ref="authenticationEntryPoint">
        <intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED"/>
        <intercept-url pattern="/j_spring_security_check" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
        <intercept-url pattern="/j_spring_security_logout" access="IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED"/>
<!-- Enable CSRF protection -->
        <csrf />
    <access-denied-handler ref="accessDeniedHandler"/>         
    </http>
<!-- Remaining information -->
</beans:beans>

我正在为项目使用Spring 3.0.5 jar。

但是在运行时,出现以下错误

SEVERE: Exception sending context initialized event to listener 
instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
 nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: 
Invalid content was found starting with element 'csrf'. 
One of 
'{"http://www.springframework.org/schema/security":intercept-url,
 "http://www.springframework.org/schema/security":access-denied-handler, 
"http://www.springframework.org/schema/security":form-login, 
"http://www.springframework.org/schema/security":openid-login, 
"http://www.springframework.org/schema/security":x509, 
"http://www.springframework.org/schema/security":http-basic, 
"http://www.springframework.org/schema/security":logout, 
"http://www.springframework.org/schema/security":session-management, 
"http://www.springframework.org/schema/security":remember-me, 
"http://www.springframework.org/schema/security":anonymous, 
"http://www.springframework.org/schema/security":port-mappings, 
"http://www.springframework.org/schema/security":custom-filter, 
"http://www.springframework.org/schema/security":request-cache}' 
is expected.

我尝试在Google上搜索此错误。我找到了两个类似的地方,但是他们都说错误是由于Spring 3.2+中的某些更改引起的。但是,就我而言,我正在使用Spring 3.0.5。

任何帮助,将不胜感激。

洛伦兹·菲斯特(Lorenz Pfisterer)

我认为Spring Security的csrf快捷方式是在3.2.0版本中引入的(请参阅blogpost

也许您应该考虑更新您使用的Spring版本

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

'解组错误:cvc-complex-type.2.4.a:发现无效的内容,从元素'XXXXX'开始。预期为“ {XXXXX}”之一

来自分类Dev

cvc-complex-type.2.4.a:发现无效的内容(从元素'MarkupListURI'开始)。预期为“ {MarkupDeleteURI}”之一

来自分类Dev

cvc-complex-type.2.4.a:发现无效的内容(从元素'ProcessDesc'开始)。预期为ProcessName之一

来自分类Dev

cvc-complex-type.2.4.a:发现无效的内容(从元素“ bean”开始)

来自分类Dev

cvc-complex-type.2.4.a:发现无效的内容(从元素“ param”开始)。预期为“ {param}”之一

来自分类Dev

lineNumber:12; columnNumber:139; cvc-complex-type.2.4.a:发现无效的内容(从元素'beans:bean'开始)

来自分类Dev

cvc-complex-type.2.4。在faces-config.xml中发现了以元素工厂开头的无效内容

来自分类Dev

出现错误cvc-complex-type.2.4.d:通过Java代码编译jrxml时,发现以元素“ paragraph”开头的内容无效

来自分类Dev

为什么Spring Security config在Websphere Application Server上生成cvc-complex-type.2.4.c?

来自分类Dev

错误消息“ cvc-complex-type.4:属性'bean-discovery-mode'必须出现在元素'beans'上。”

来自分类Dev

cvc-complex-type.4:属性 {0} 必须出现在元素 {1} 上

来自分类Dev

Spring上下文错误:SAXParseException cvc-complex-type.3.2.2忽略无法解析的上下文:属性占位符

来自分类Dev

启用Spring存储库cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素jpa:repositories的声明

来自分类Dev

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'bean'的声明-Spring config问题

来自分类Dev

启用Spring存储库cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素jpa:repositories的声明

来自分类Dev

HandlerInterceptorAdaptarer Spring-从元素'bean'开始发现无效内容

来自分类Dev

cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素“ mvc:annotation-driven”错误的声明

来自分类Dev

春季安全错误:cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'http'的声明

来自分类Dev

Mule SAXParseException:cvc-complex-type.2.4.a:使用专有连接器运行Flow时内容无效。

来自分类Dev

RAD 中的 Websphere Liberty server.xml 在密钥库上提供 cvc-complex-type.2.4.a

来自分类Dev

org.xml.sax.SAXParseException;cvc-complex-type.2.4.c: 匹配通配符严格,但找不到声明

来自分类Dev

Angular 2 / Spring Security CSRF实施问题

来自分类Dev

从元素开始发现无效的内容

来自分类Dev

cvc-complex-type.2.1:元素'property'必须没有字符或元素信息项[children],因为该类型的内容类型为空

来自分类Dev

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

来自分类Dev

cvc-complex-type.3.2.2:不允许属性“ username-parameter”出现在元素“ form-login”中

来自分类Dev

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

来自分类Dev

“ cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素'context:component-scan'的声明。”

来自分类Dev

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

Related 相关文章

  1. 1

    '解组错误:cvc-complex-type.2.4.a:发现无效的内容,从元素'XXXXX'开始。预期为“ {XXXXX}”之一

  2. 2

    cvc-complex-type.2.4.a:发现无效的内容(从元素'MarkupListURI'开始)。预期为“ {MarkupDeleteURI}”之一

  3. 3

    cvc-complex-type.2.4.a:发现无效的内容(从元素'ProcessDesc'开始)。预期为ProcessName之一

  4. 4

    cvc-complex-type.2.4.a:发现无效的内容(从元素“ bean”开始)

  5. 5

    cvc-complex-type.2.4.a:发现无效的内容(从元素“ param”开始)。预期为“ {param}”之一

  6. 6

    lineNumber:12; columnNumber:139; cvc-complex-type.2.4.a:发现无效的内容(从元素'beans:bean'开始)

  7. 7

    cvc-complex-type.2.4。在faces-config.xml中发现了以元素工厂开头的无效内容

  8. 8

    出现错误cvc-complex-type.2.4.d:通过Java代码编译jrxml时,发现以元素“ paragraph”开头的内容无效

  9. 9

    为什么Spring Security config在Websphere Application Server上生成cvc-complex-type.2.4.c?

  10. 10

    错误消息“ cvc-complex-type.4:属性'bean-discovery-mode'必须出现在元素'beans'上。”

  11. 11

    cvc-complex-type.4:属性 {0} 必须出现在元素 {1} 上

  12. 12

    Spring上下文错误:SAXParseException cvc-complex-type.3.2.2忽略无法解析的上下文:属性占位符

  13. 13

    启用Spring存储库cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素jpa:repositories的声明

  14. 14

    cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'bean'的声明-Spring config问题

  15. 15

    启用Spring存储库cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素jpa:repositories的声明

  16. 16

    HandlerInterceptorAdaptarer Spring-从元素'bean'开始发现无效内容

  17. 17

    cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素“ mvc:annotation-driven”错误的声明

  18. 18

    春季安全错误:cvc-complex-type.2.4.c:匹配的通配符很严格,但是找不到元素'http'的声明

  19. 19

    Mule SAXParseException:cvc-complex-type.2.4.a:使用专有连接器运行Flow时内容无效。

  20. 20

    RAD 中的 Websphere Liberty server.xml 在密钥库上提供 cvc-complex-type.2.4.a

  21. 21

    org.xml.sax.SAXParseException;cvc-complex-type.2.4.c: 匹配通配符严格,但找不到声明

  22. 22

    Angular 2 / Spring Security CSRF实施问题

  23. 23

    从元素开始发现无效的内容

  24. 24

    cvc-complex-type.2.1:元素'property'必须没有字符或元素信息项[children],因为该类型的内容类型为空

  25. 25

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

  26. 26

    cvc-complex-type.3.2.2:不允许属性“ username-parameter”出现在元素“ form-login”中

  27. 27

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

  28. 28

    “ cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素'context:component-scan'的声明。”

  29. 29

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

热门标签

归档