HTTP Status 500 – No bean named ‘springSecurityFilterChain’ is defined

Trace:

HTTP Status 500 - No bean named 'springSecurityFilterChain' is defined

type Exception report

message No bean named 'springSecurityFilterChain' is defined

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined
  org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:701)
  org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1180)
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
  org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1082)
  org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:255)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.59 logs.
Apache Tomcat/7.0.59

 Solutions:

It’s indicate that spring security bean has not been created and spring security trying find that bean with name ‘springSecurityFilterChain’,

To Resolve following error please check following things are available in your web.xml or not?

First:

org.springframework.web.context.ContextLoaderListener Listener should be in your web.xml file.

<listener>
       <listener-class>
           org.springframework.web.context.ContextLoaderListener
       </listener-class>
</listener>

Second:

org.springframework.web.filter.DelegatingFilterProxy filter should be in your web.xml file.

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

   <filter-mapping>
       <filter-name>springSecurityFilterChain</filter-name>
       <url-pattern>/*</url-pattern>
   </filter-mapping>

Third:

spring configuration file should in your class path defined in web.xml file.

<context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>
           /WEB-INF/mvc-dispatcher-servlet.xml
           /WEB-INF/spring-security.xml
       </param-value>
   </context-param>

 

 

Was this post helpful?
Let us know, if you liked the post. Only in this way, we can improve us.
Yes
No

Leave a Reply

Your email address will not be published. Required fields are marked *