Error creating bean with name 'org.springframework.security.filterChains











up vote
0
down vote

favorite












this is my dispatcher-servlet.xml



 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>



<context:component-scan base-package="com.controller"/>
<mvc:annotation-driven/>

<bean id="student_dao" class="com.dao.User_dao_imp"/>
<bean id="student_service" class="com.service.User_service_imp"/>
<bean id="product_dao" class="com.dao.Product_dao_impl"/>
<bean id="product_service" class="com.service.Product_service_impl"/>

<bean id="userdetail" class="com.controller.UserDetail" />


<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/config/messages"/>
<property name="defaultEncoding" value="UTF-8"/>
</bean>



<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="index.htm">indexController</prop>
</props>
</property>
</bean>

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />

<!--
The index controller.
-->
<bean name="indexController"
class="org.springframework.web.servlet.mvc.ParameterizableViewController"
p:viewName="index" />



</beans>


this is my security.xml



     <?xml version="1.0" encoding="UTF-8"?>


<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-3.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd">

<http use-expressions="true">
<intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
<form-login login-page="/login.htm"/>
<logout logout-url="/logout"/>
</http>


<authentication-manager>
<authentication-provider user-service-ref="userdetail">
<password-encoder hash="bcrypt" />
</authentication-provider>
</authentication-manager>

</beans:beans>


After debugging i am getting error



SEVERE: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [3]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userdetail' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userdetail' is defined










share|improve this question


























    up vote
    0
    down vote

    favorite












    this is my dispatcher-servlet.xml



     <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

    <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>



    <context:component-scan base-package="com.controller"/>
    <mvc:annotation-driven/>

    <bean id="student_dao" class="com.dao.User_dao_imp"/>
    <bean id="student_service" class="com.service.User_service_imp"/>
    <bean id="product_dao" class="com.dao.Product_dao_impl"/>
    <bean id="product_service" class="com.service.Product_service_impl"/>

    <bean id="userdetail" class="com.controller.UserDetail" />


    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename" value="/WEB-INF/config/messages"/>
    <property name="defaultEncoding" value="UTF-8"/>
    </bean>



    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="index.htm">indexController</prop>
    </props>
    </property>
    </bean>

    <bean id="viewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver"
    p:prefix="/WEB-INF/jsp/"
    p:suffix=".jsp" />

    <!--
    The index controller.
    -->
    <bean name="indexController"
    class="org.springframework.web.servlet.mvc.ParameterizableViewController"
    p:viewName="index" />



    </beans>


    this is my security.xml



         <?xml version="1.0" encoding="UTF-8"?>


    <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-3.2.xsd
    http://www.springframework.org/schema/security
    http://www.springframework.org/schema/security/spring-security-3.2.xsd">

    <http use-expressions="true">
    <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
    <form-login login-page="/login.htm"/>
    <logout logout-url="/logout"/>
    </http>


    <authentication-manager>
    <authentication-provider user-service-ref="userdetail">
    <password-encoder hash="bcrypt" />
    </authentication-provider>
    </authentication-manager>

    </beans:beans>


    After debugging i am getting error



    SEVERE: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [3]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userdetail' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userdetail' is defined










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      this is my dispatcher-servlet.xml



       <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:p="http://www.springframework.org/schema/p"
      xmlns:aop="http://www.springframework.org/schema/aop"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

      <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>



      <context:component-scan base-package="com.controller"/>
      <mvc:annotation-driven/>

      <bean id="student_dao" class="com.dao.User_dao_imp"/>
      <bean id="student_service" class="com.service.User_service_imp"/>
      <bean id="product_dao" class="com.dao.Product_dao_impl"/>
      <bean id="product_service" class="com.service.Product_service_impl"/>

      <bean id="userdetail" class="com.controller.UserDetail" />


      <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
      <property name="basename" value="/WEB-INF/config/messages"/>
      <property name="defaultEncoding" value="UTF-8"/>
      </bean>



      <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
      <property name="mappings">
      <props>
      <prop key="index.htm">indexController</prop>
      </props>
      </property>
      </bean>

      <bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"
      p:prefix="/WEB-INF/jsp/"
      p:suffix=".jsp" />

      <!--
      The index controller.
      -->
      <bean name="indexController"
      class="org.springframework.web.servlet.mvc.ParameterizableViewController"
      p:viewName="index" />



      </beans>


      this is my security.xml



           <?xml version="1.0" encoding="UTF-8"?>


      <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-3.2.xsd
      http://www.springframework.org/schema/security
      http://www.springframework.org/schema/security/spring-security-3.2.xsd">

      <http use-expressions="true">
      <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
      <form-login login-page="/login.htm"/>
      <logout logout-url="/logout"/>
      </http>


      <authentication-manager>
      <authentication-provider user-service-ref="userdetail">
      <password-encoder hash="bcrypt" />
      </authentication-provider>
      </authentication-manager>

      </beans:beans>


      After debugging i am getting error



      SEVERE: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [3]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userdetail' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userdetail' is defined










      share|improve this question













      this is my dispatcher-servlet.xml



       <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:p="http://www.springframework.org/schema/p"
      xmlns:aop="http://www.springframework.org/schema/aop"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">

      <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>



      <context:component-scan base-package="com.controller"/>
      <mvc:annotation-driven/>

      <bean id="student_dao" class="com.dao.User_dao_imp"/>
      <bean id="student_service" class="com.service.User_service_imp"/>
      <bean id="product_dao" class="com.dao.Product_dao_impl"/>
      <bean id="product_service" class="com.service.Product_service_impl"/>

      <bean id="userdetail" class="com.controller.UserDetail" />


      <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
      <property name="basename" value="/WEB-INF/config/messages"/>
      <property name="defaultEncoding" value="UTF-8"/>
      </bean>



      <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
      <property name="mappings">
      <props>
      <prop key="index.htm">indexController</prop>
      </props>
      </property>
      </bean>

      <bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"
      p:prefix="/WEB-INF/jsp/"
      p:suffix=".jsp" />

      <!--
      The index controller.
      -->
      <bean name="indexController"
      class="org.springframework.web.servlet.mvc.ParameterizableViewController"
      p:viewName="index" />



      </beans>


      this is my security.xml



           <?xml version="1.0" encoding="UTF-8"?>


      <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-3.2.xsd
      http://www.springframework.org/schema/security
      http://www.springframework.org/schema/security/spring-security-3.2.xsd">

      <http use-expressions="true">
      <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
      <form-login login-page="/login.htm"/>
      <logout logout-url="/logout"/>
      </http>


      <authentication-manager>
      <authentication-provider user-service-ref="userdetail">
      <password-encoder hash="bcrypt" />
      </authentication-provider>
      </authentication-manager>

      </beans:beans>


      After debugging i am getting error



      SEVERE: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [3]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': Cannot resolve reference to bean 'userdetail' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userdetail' is defined







      spring spring-security






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 10 '15 at 18:20









      user3726079

      31125




      31125
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Define your userdetail bean in security.xml configuration, something like this:



          <?xml version="1.0" encoding="UTF-8"?>
          <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-3.2.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.2.xsd">

          <http use-expressions="true">
          <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
          <form-login login-page="/login.htm"/>
          <logout logout-url="/logout"/>
          </http>


          <authentication-manager>
          <authentication-provider user-service-ref="userdetail">
          <password-encoder hash="bcrypt" />
          </authentication-provider>
          </authentication-manager>

          <beans:bean id="userdetail" class="com.controller.UserDetail" />
          </beans:beans>





          share|improve this answer





















          • it is defined, problem in something else
            – msangel
            Jan 11 '15 at 1:24










          • I know you defined it in dispatcher-servlet.xml but somehow spring container could not recognize it. copy userdetail bean definition from dispatcher-servlet.xml to security.xml.
            – Ali Dehghani
            Jan 11 '15 at 10:47












          • Have a closer look at stacktrace: NoSuchBeanDefinitionException: No bean named 'userdetail' is defined
            – Ali Dehghani
            Jan 11 '15 at 10:48













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27879610%2ferror-creating-bean-with-name-org-springframework-security-filterchains%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Define your userdetail bean in security.xml configuration, something like this:



          <?xml version="1.0" encoding="UTF-8"?>
          <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-3.2.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.2.xsd">

          <http use-expressions="true">
          <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
          <form-login login-page="/login.htm"/>
          <logout logout-url="/logout"/>
          </http>


          <authentication-manager>
          <authentication-provider user-service-ref="userdetail">
          <password-encoder hash="bcrypt" />
          </authentication-provider>
          </authentication-manager>

          <beans:bean id="userdetail" class="com.controller.UserDetail" />
          </beans:beans>





          share|improve this answer





















          • it is defined, problem in something else
            – msangel
            Jan 11 '15 at 1:24










          • I know you defined it in dispatcher-servlet.xml but somehow spring container could not recognize it. copy userdetail bean definition from dispatcher-servlet.xml to security.xml.
            – Ali Dehghani
            Jan 11 '15 at 10:47












          • Have a closer look at stacktrace: NoSuchBeanDefinitionException: No bean named 'userdetail' is defined
            – Ali Dehghani
            Jan 11 '15 at 10:48

















          up vote
          0
          down vote













          Define your userdetail bean in security.xml configuration, something like this:



          <?xml version="1.0" encoding="UTF-8"?>
          <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-3.2.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.2.xsd">

          <http use-expressions="true">
          <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
          <form-login login-page="/login.htm"/>
          <logout logout-url="/logout"/>
          </http>


          <authentication-manager>
          <authentication-provider user-service-ref="userdetail">
          <password-encoder hash="bcrypt" />
          </authentication-provider>
          </authentication-manager>

          <beans:bean id="userdetail" class="com.controller.UserDetail" />
          </beans:beans>





          share|improve this answer





















          • it is defined, problem in something else
            – msangel
            Jan 11 '15 at 1:24










          • I know you defined it in dispatcher-servlet.xml but somehow spring container could not recognize it. copy userdetail bean definition from dispatcher-servlet.xml to security.xml.
            – Ali Dehghani
            Jan 11 '15 at 10:47












          • Have a closer look at stacktrace: NoSuchBeanDefinitionException: No bean named 'userdetail' is defined
            – Ali Dehghani
            Jan 11 '15 at 10:48















          up vote
          0
          down vote










          up vote
          0
          down vote









          Define your userdetail bean in security.xml configuration, something like this:



          <?xml version="1.0" encoding="UTF-8"?>
          <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-3.2.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.2.xsd">

          <http use-expressions="true">
          <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
          <form-login login-page="/login.htm"/>
          <logout logout-url="/logout"/>
          </http>


          <authentication-manager>
          <authentication-provider user-service-ref="userdetail">
          <password-encoder hash="bcrypt" />
          </authentication-provider>
          </authentication-manager>

          <beans:bean id="userdetail" class="com.controller.UserDetail" />
          </beans:beans>





          share|improve this answer












          Define your userdetail bean in security.xml configuration, something like this:



          <?xml version="1.0" encoding="UTF-8"?>
          <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-3.2.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.2.xsd">

          <http use-expressions="true">
          <intercept-url pattern="/add_role.htm" access="hasRole('ROLE_ADMIN')" />
          <form-login login-page="/login.htm"/>
          <logout logout-url="/logout"/>
          </http>


          <authentication-manager>
          <authentication-provider user-service-ref="userdetail">
          <password-encoder hash="bcrypt" />
          </authentication-provider>
          </authentication-manager>

          <beans:bean id="userdetail" class="com.controller.UserDetail" />
          </beans:beans>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 10 '15 at 20:46









          Ali Dehghani

          24.7k786101




          24.7k786101












          • it is defined, problem in something else
            – msangel
            Jan 11 '15 at 1:24










          • I know you defined it in dispatcher-servlet.xml but somehow spring container could not recognize it. copy userdetail bean definition from dispatcher-servlet.xml to security.xml.
            – Ali Dehghani
            Jan 11 '15 at 10:47












          • Have a closer look at stacktrace: NoSuchBeanDefinitionException: No bean named 'userdetail' is defined
            – Ali Dehghani
            Jan 11 '15 at 10:48




















          • it is defined, problem in something else
            – msangel
            Jan 11 '15 at 1:24










          • I know you defined it in dispatcher-servlet.xml but somehow spring container could not recognize it. copy userdetail bean definition from dispatcher-servlet.xml to security.xml.
            – Ali Dehghani
            Jan 11 '15 at 10:47












          • Have a closer look at stacktrace: NoSuchBeanDefinitionException: No bean named 'userdetail' is defined
            – Ali Dehghani
            Jan 11 '15 at 10:48


















          it is defined, problem in something else
          – msangel
          Jan 11 '15 at 1:24




          it is defined, problem in something else
          – msangel
          Jan 11 '15 at 1:24












          I know you defined it in dispatcher-servlet.xml but somehow spring container could not recognize it. copy userdetail bean definition from dispatcher-servlet.xml to security.xml.
          – Ali Dehghani
          Jan 11 '15 at 10:47






          I know you defined it in dispatcher-servlet.xml but somehow spring container could not recognize it. copy userdetail bean definition from dispatcher-servlet.xml to security.xml.
          – Ali Dehghani
          Jan 11 '15 at 10:47














          Have a closer look at stacktrace: NoSuchBeanDefinitionException: No bean named 'userdetail' is defined
          – Ali Dehghani
          Jan 11 '15 at 10:48






          Have a closer look at stacktrace: NoSuchBeanDefinitionException: No bean named 'userdetail' is defined
          – Ali Dehghani
          Jan 11 '15 at 10:48




















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f27879610%2ferror-creating-bean-with-name-org-springframework-security-filterchains%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word