I read most of these questions that have already been submitted, but still I could not find a solution. Please note that the regular CRUD application is working fine. I get this error when I try to add login functions through spring-security.
My work environment is as follows:
1.Tomcat 7.0.35
2.Spring 3.2.0
3.Spring Security
spring-Security-configuration-3.1.3.RELEASE.jar
spring-Security-kernel-3.1.3.RELEASE.jar
spring -Security-tag libraries-3.1.3.RELEASE.jar
spring -Security-Web 3.1.3.RELEASE.jar
4.My web.xml (/src/main/webapp/WEB-INF/web.xml)
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/root-context.xml</param-value> </context-param> <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> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:spring/conf/*-context.xml </param-value> </init-param> </servlet> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet-mapping> <servlet-name>appServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
5.My security-context.xml (/ src / main / resources / spring / conf / security-context.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" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"> <http pattern="/resources" security="none" /> <http auto-config="true" use-expressions="true"> <intercept-url pattern="/login" access="permitAll"/> <intercept-url pattern="/logout" access="permitAll"/> <intercept-url pattern="/denied" access="hasRole('ROLE_USER')"/> <intercept-url pattern="/" access="hasRole('ROLE_USER')"/> <intercept-url pattern="/user" access="hasRole('ROLE_USER')"/> <intercept-url pattern="/admin" access="hasRole('ROLE_ADMIN')"/> <form-login login-page="/login" authentication-failure-url="/login/failure" default-target-url="/"/> <access-denied-handler error-page="/denied"/> <logout invalidate-session="true" logout-success-url="/logout/success" logout-url="/logout"/> </http> <authentication-manager> <authentication-provider user-service-ref="customUserDetailsService"> <password-encoder hash="md5"/> </authentication-provider> </authentication-manager>
6.Error
INFO: Initializing Spring root WebApplicationContext INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sun Feb 10 22:17:40 IST 2013]; root of context hierarchy INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [spring/root-context.xml] INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.s pringframework.beans.factory.support.DefaultListableBeanFactory@ 58d51a54: defining beans []; root of factory hierarchy INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 353 ms 10-Feb-2013 22:17:40 org.apache.catalina.core.StandardContext filterStart SEVERE: Exception starting filter springSecurityFilterChain org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:549) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1096) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121) at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326) at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:236) at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:194) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5312) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Please help me ... Thanks
source share