2012-04-18 17 views
5

मैं मूल वसंत सुरक्षा सेट अप करने की कोशिश कर रहा हूं।वसंत सुरक्षा- बीन '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 इस प्रकार मैं 3.1.0.RELEASE मैं वसंत सुरक्षा एक्सएमएल में उपयोग कर रहा हूँ : नाम 'org.springframework.security.filterChains' के साथ बीन बनाने में त्रुटि: बीन की शुरुआत विफल रही; नेस्टेड अपवाद java.lang है। NoSuchFieldError: NULL।

क्या कोई मेरी मदद कर सकता है?

+0

org.springframework.beans.factory.BeanCreationException: नाम 'org.springframework.security.filterChains' नाम से बीन बनाने में त्रुटि: बीन की शुरुआत विफल हुई; नेस्टेड अपवाद java.lang.No.SuchFieldError: NULL \t org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:5227) – jrpalla

+0

**************** ********** वेब एक्सएमएल *********** <संदर्भ param> contextConfigLocation /WEB-INF/applicationContext-security.xml springSecurityFilterChain <फिल्टर स्तरीय> org.springframework.web.filter.DelegatingFilterProxy <फिल्टर-मानचित्रण> springSecurityFilterChain /* jrpalla

+1

Stackoverflow करने के लिए आपका स्वागत है। एक संकेत: आदेश जोड़ने के बजाय, आप सवाल संपादित कर सकते हैं, इससे इसे और अधिक पठनीय बना दिया जाएगा। – Ralph

उत्तर

0

आपका web.xml लगता है कि आप याद org.springframework.web.context.ContextLoaderListener

आपका web.xml shoul इस तत्व:

<!-- 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 वसंत के पुराने संस्करणों में खींचती है जो एक मूक संघर्ष पैदा करती है। मेरे मामले में वसंत-सुरक्षा-3.1.0.RELEASE वसंत-एओपी, वसंत-जेडीबीसी, वसंत-टीएक्स और वसंत-अभिव्यक्ति 3.0.6 में खींचा गया लेकिन मैं वसंत 3.1.0 का उपयोग कर रहा था .RELEASE। इन निर्भरताओं को स्पष्ट रूप से जोड़ने के बाद समस्या दूर हो गई।

+0

यह सही निदान है, एओपी/जेडीबीसी/आदि के लिए डीपी प्रबंधन जोड़ें और यह इसे ठीक करेगा: – ianpojman

संबंधित मुद्दे