2012-04-18 14 views
5

私は基本的な春のセキュリティを設定しようとしています。私は次のように私は春のセキュリティ、XMLを持っている3.1.0.RELEASE を使用しています:春のセキュリティ - Bean 'org.springframework.security.filterChains'の作成エラー

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

<security:authentication-manager> 
<security:authentication-provider> 
<security:user-service> 
<security:user name="jimi" password="jimispassword" authorities="ROLE_USER,  ROLE_ADMIN" /> 
<security:user name="bob" password="bobspassword" authorities="ROLE_USER" /> 
</security:user-service> 
</security:authentication-provider> 
</security:authentication-manager> 

私はスタート・ページにアクセスすると、私は次の例外を取得: org.springframework.beans.factory.BeanCreationExce ptionを: 'org.springframework.security.filterChains'という名前のBeanを作成中にエラーが発生しました:Beanの初期化に失敗しました。ネストされた例外はjava.lang.NoSuchFieldError:NULLです。

誰でも助けてくれますか?

+0

org.springframework.beans.factory.BeanCreationException: 'org.springframework.security.filterChains'という名前のBeanを作成中にエラーが発生しました:Beanの初期化に失敗しました。ネストされた例外はjava.lang.NoSuchFieldErrorのです:NULL \t org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) – jrpalla

+0

で**************** **********ウェブXML *********** <コンテキスト-param>の ​​contextConfigLocation /WEB-INF/applicationContext-security.xml springSecurityFilterChain <フィルタクラス> org.springframework.web.filter.DelegatingFilterProxy <のfilter-mapping> springSecurityFilterChainにStackOverflowに /* jrpalla

+1

ようこそ。 1つのヒント:コマンドを追加するのではなく、質問を編集することができます。これにより、読みやすくなります。 – Ralph

答えて

0

あなたのあなたはweb.xmlこの要素持っshoulあなたorg.springframework.web.context.ContextLoaderListener

を逃したようweb.xmlに見える:正直に言うと

<!-- or in your case /WEB-INF/applicationContext-security.xml --> 
<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value> 
</context-param> 

<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 

<servlet> 
    <servlet-name>My-Web-SpringProject</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <init-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/spring/webmvc-config.xml</param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

<filter-mapping> 
    <!-- do not change this name! --> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

<!-- Creates the Spring Container shared by all Servlets and Filters --> 
<!-- it is configured by the parameter contextConfigLocation in the begining --> 
<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 

<servlet-mapping> 
    <servlet-name>My-Web-SpringProject</servlet-name> 
    <url-pattern>/</url-pattern> 
</servlet-mapping> 

を、この春3.0の構成であるが、私はそれがために同じだと思います3.1

11

実際の問題の原因は、スプリング・セキュリティ3.1.0が古いバージョンのスプリングをプルしてサイレント・コンフリクトを引き起こしているようです。私の場合、spring-security-3.1.0.RELEASEはspring-aop、spring-jdbc、spring-tx、spring-expression 3.0.6で引っ張られましたが、私はSpring 3.1.0.RELEASEを使用していました。これらの依存関係を明示的に追加した後、問題はなくなりました。

+0

これは正しい診断で、aop/jdbc/etcのdep管理を追加すると修正されます: – ianpojman

関連する問題