2012-04-18 17 views
5

Estoy intentando configurar la seguridad básica del muelle. Estoy usando 3.1.0.RELEASE que tengo en el xml de seguridad muelle del modo siguiente:Spring Security-Error creando 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> 

Cuando tengo acceso a la página de inicio, me sale el siguiente excepción: ption org.springframework.beans.factory.BeanCreationExce : Error al crear bean con el nombre 'org.springframework.security.filterChains': Falló la inicialización del bean; la excepción anidada es java.lang.NoSuchFieldError: NULL.

¿Alguien me puede ayudar?

+0

org.springframework.beans.factory.BeanCreationException: Error al crear bean con el nombre 'org.springframework.security.filterChains': Inicialización de bean failed; la excepción anidada es java.lang.NoSuchFieldError: NULL \t en org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:527) – jrpalla

+0

**************** ********** web XML *********** contextConfigLocation /WEB-INF/applicationContext-security.xml springSecurityFilterChain <-clase de filtro> org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* jrpalla

+1

Bienvenido a Stackoverflow. Una sugerencia: en lugar de agregar comandos, puedes editar la pregunta, esto la haría más legible. – Ralph

Respuesta

0

Su web.xml parece que se perdió el org.springframework.web.context.ContextLoaderListener

Su web.xml aquí serán tener estos elementos:

<!-- 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> 

Para ser honesto, esta es una configuración de Spring 3.0, pero creo que es el mismo para 3.1

11

La causa real del problema parece ser que Spring-security 3.1.0 extrae versiones anteriores de Spring que crean un conflicto silencioso. En mi caso spring-security-3.1.0.RELEASE sacó spring-aop, spring-jdbc, spring-tx y spring-expression 3.0.6 pero estaba usando la primavera 3.1.0.RELEASE. Después de agregar estas dependencias explícitamente, el problema desapareció.

+0

este es el diagnóstico correcto, agregue la administración de dep para aop/jdbc/etc y lo reparará: – ianpojman

Cuestiones relacionadas