org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy1220 cannot be cast to org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy1220 cannot be cast to org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:541)[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java)[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)[spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)[spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)[spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4840)[catalina.jar:8.0.36] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)[catalina.jar:8.0.36] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)[catalina.jar:8.0.36] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)[catalina.jar:8.0.36] at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)[catalina.jar:8.0.36] at java.util.concurrent.FutureTask.run(FutureTask.java:266)[?:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[?:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[?:1.8.0_92] at java.lang.Thread.run(Thread.java:745)[?:1.8.0_92] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy1220 cannot be cast to org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] ... 24 more Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy1220 cannot be cast to org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter at org.springframework.security.config.annotation.web.configurers.ServletApiConfigurer.configure(ServletApiConfigurer.java:94)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.web.configurers.ServletApiConfigurer.configure(ServletApiConfigurer.java:58)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.configure(AbstractConfiguredSecurityBuilder.java:383)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:329)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.web.builders.WebSecurity.performBuild(WebSecurity.java:287)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.web.builders.WebSecurity.performBuild(WebSecurity.java:74)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:333)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:105)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$e2e8bac5.CGLIB$springSecurityFilterChain$0(<generated>)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$e2e8bac5$$FastClassBySpringCGLIB$$cf12ae7c.invoke(<generated>)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$e2e8bac5.springSecurityFilterChain(<generated>)[spring-security-config-4.1.0.RELEASE.jar:4.1.0.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[?:1.8.0_92] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[?:1.8.0_92] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[?:1.8.0_92] at java.lang.reflect.Method.invoke(Method.java:498)[?:1.8.0_92] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE] ... 25 more
No Bugmate found.