spring-security配置错误,启动tomcat时报错

applicationContext-security.xml:
[code="java"]<?xml version="1.0" encoding="UTF-8"?>
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 pre-post-annotations="enabled">

</global-method-security>

<http use-expressions="true">
    <intercept-url pattern="/secure/extreme/**" access="hasRole('ROLE_SUPERVISOR')"/>
    <intercept-url pattern="/secure/**" access="isAuthenticated()" />
    <intercept-url pattern="/**" access="permitAll" />
    <form-login />
    <logout />
    <remember-me />

    <session-management invalid-session-url="/timeout.jsp">
        <concurrency-control max-sessions="1" error-if-maximum-exceeded="true" />
    </session-management>

</http>

<authentication-manager>
    <authentication-provider>
        <password-encoder hash="md5"/>
        <user-service>
            <user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER" />
            <user name="dianne" password="65d15fe9156f9c4bbffd98085992a44e" authorities="ROLE_USER,ROLE_TELLER" />
            <user name="scott" password="2b58af6dddbd072ed27ffc86725d7d3a" authorities="ROLE_USER" />
            <user name="peter" password="22b5c9accc6e1ba628cedc63a72d57f8" authorities="ROLE_USER" />
        </user-service>
    </authentication-provider>
</authentication-manager>

/beans:beans[/code]

错误信息:
[code="java"]2010-03-16 17:15:12 [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/classes/applicationContext-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.getLocalName(Lorg/w3c/dom/Node;)Ljava/lang/String;
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
.........................[/code]

3个回答

哦,看这个帖子

https://jira.springsource.org/browse/SEC-1397

Spring 2.5.6 is not compatible with Spring Security 3. You must use Spring 3.

你用的是Spring 2.5.6吗? 该成 Spring 3试试看。

看这个帖子,和你遇到的情况是一样的

http://www.operamasks.org/forum/viewthread.php?action=printable&tid=5035

情况一:如果managedbean编译生成的class文件放到WEB-INF/classes目录下面,view与managedBean可以正常绑定。
情况二:如果managedbean编译生成的class文件被打包成jar,放到WEB-INF/lib目录下面,view与managedBean不能绑定。

异常就是在解决xml文件的时候导致的
会不会你依赖的jar包有问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!