0

您好,当我尝试从 Spring Security 2.0.4 迁移到 Spring Security 3.0.5.RELEASE 时遇到问题。我收到以下错误:

    SEVERE: Exception sending context initialized event to listener instance of class pl.casses.fw.client.info.app.OfficeContextLoader
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/office-mgt-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.getLocalName(Lorg/w3c/dom/Node;)Ljava/lang/String;

我的 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-2.0.xsd
          http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http auto-config='true'>
    <intercept-url pattern="/**/*.ico" filters="none" />
    <intercept-url pattern="/**/*.gif" filters="none" />
    <intercept-url pattern="/**/*.jpg" filters="none" />
    <intercept-url pattern="/**/*.css" filters="none" />
    <intercept-url pattern="/**/*.js" filters="none" />
    <intercept-url pattern="/**/*.png" filters="none" />
    <intercept-url pattern="/logout.jsp*" filters="none" />
    <intercept-url pattern="/index.jsp*" filters="none" />
    <intercept-url pattern="/**" access="ROLE_USER,ROLE_ADMIN" />
    <form-login login-page="/index.jsp"
        authentication-failure-url="/index.jsp?login_error=1"
        default-target-url="/main.jsp" always-use-default-target="true" />
    <remember-me key="CassesOMRMKey" user-service-ref="userFactory"/>
</http>

<authentication-manager>
    <authentication-provider user-service-ref="userFactory">
        <password-encoder hash="md5" />
    </authentication-provider>
</authentication-manager> 

在 pom.xml 我有:

<dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>2.5.4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>

我做错了什么?如何迁移到安全 3.0。提前感谢您的回答。

4

1 回答 1

0

解决方案分两步得出:

  1. 对两个工件使用相同的 Spring Release;
  2. 更新 maven 依赖项,将 pom.xml 中的排除项添加到使用 3.0 以下版本的所有 spring 工件(感谢@caro2 指出这一点)
于 2013-01-14T13:32:45.523 回答