org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: 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 org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.security.oauth2.provider.token.ResourceServerTokenServices] is defined: expected single matching bean but found 2: remoteTokenServices,defaultAuthorizationServerTokenServices

GitHub | frickt | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Error when starting github SocialApplication

    GitHub | 1 year ago | frickt
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: 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 org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.security.oauth2.provider.token.ResourceServerTokenServices] is defined: expected single matching bean but found 2: remoteTokenServices,defaultAuthorizationServerTokenServices
  2. 0

    Exception starting filter springSecurityFilterChain

    GitHub | 1 year ago | chdanish
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: 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 org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.security.oauth2.provider.token.ResourceServerTokenServices] is defined: expected single matching bean but found 2: remoteTokenServices,defaultAuthorizationServerTokenServices
  3. 0

    expected single matching bean but found 2 exception

    Stack Overflow | 2 years ago | Shalima Sidhik
    org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [dao.BaseDAO] is defined: expected single matching bean but found 2: baseDAO,claimsDAO
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I try to access multi tenant database, i get BeanCreationException

    GitHub | 1 year ago | winkumar
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'locationEntityManagerFactory' defined in com.multitenant.config.LocationPersistenceConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'locationEntityManagerFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'locationDataSource' defined in com.multitenant.config.LocationPersistenceConfig: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceInitializer': Invocation of init method failed; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] is defined: expected single matching bean but found 2: tenantDataSource,locationDataSource
  6. 0

    GitHub comment 4704#162803666

    GitHub | 1 year ago | winkumar
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'locationEntityManagerFactory' defined in class path resource [com/multitenant/config/LocationPersistenceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'locationEntityManagerFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'locationDataSource' defined in class path resource [com/multitenant/config/LocationPersistenceConfig.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceInitializer': Invocation of init method failed; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] is defined: expected single matching bean but found 2: tenantDataSource,locationDataSource
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.beans.factory.NoUniqueBeanDefinitionException

    No qualifying bean of type [org.springframework.security.oauth2.provider.token.ResourceServerTokenServices] is defined: expected single matching bean but found 2: remoteTokenServices,defaultAuthorizationServerTokenServices

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean()
  2. Spring Beans
    DefaultListableBeanFactory.getBean
    1. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:366)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    2. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:332)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    2 frames
  3. org.springframework.boot
    OAuth2SsoDefaultConfiguration.configure
    1. org.springframework.boot.autoconfigure.security.oauth2.client.SsoSecurityConfigurer.oauth2SsoFilter(SsoSecurityConfigurer.java:82)[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    2. org.springframework.boot.autoconfigure.security.oauth2.client.SsoSecurityConfigurer.configure(SsoSecurityConfigurer.java:52)[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    3. org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2SsoDefaultConfiguration.configure(OAuth2SsoDefaultConfiguration.java:57)[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    3 frames
  4. org.springframework.security
    WebSecurityConfigurerAdapter.init
    1. org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.getHttp(WebSecurityConfigurerAdapter.java:199)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    2. org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:290)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    3. org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:67)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    3 frames
  5. org.springframework.boot
    OAuth2SsoDefaultConfiguration$$EnhancerBySpringCGLIB$$f71c55b7.init
    1. org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2SsoDefaultConfiguration$$EnhancerBySpringCGLIB$$f71c55b7.init(<generated>)[spring-boot-autoconfigure-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    1 frame
  6. org.springframework.security
    WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c923350e$$FastClassBySpringCGLIB$$1a384db9.invoke
    1. org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.init(AbstractConfiguredSecurityBuilder.java:370)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    2. org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:324)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    3. org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    4. org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:105)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    5. org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c923350e.CGLIB$springSecurityFilterChain$3(<generated>)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    6. org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c923350e$$FastClassBySpringCGLIB$$1a384db9.invoke(<generated>)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    6 frames
  7. Spring Core
    MethodProxy.invokeSuper
    1. org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    1 frame
  8. Spring Context
    ConfigurationClassEnhancer$BeanMethodInterceptor.intercept
    1. org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    1 frame
  9. org.springframework.security
    WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c923350e.springSecurityFilterChain
    1. org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$c923350e.springSecurityFilterChain(<generated>)[spring-security-config-4.0.3.RELEASE.jar:4.0.3.RELEASE]
    1 frame
  10. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_40]
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_40]
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_40]
    4. java.lang.reflect.Method.invoke(Method.java:497)[na:1.8.0_40]
    4 frames
  11. Spring Beans
    AbstractBeanFactory.getBean
    1. org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    2. org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    6. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    7. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    8. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    9. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    10. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    10 frames
  12. Spring Context
    AbstractApplicationContext.getBean
    1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1060)[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    1 frame
  13. Spring
    GenericFilterBean.init
    1. org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    2. org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235)[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    3. org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:199)[spring-web-4.2.5.RELEASE.jar:4.2.5.RELEASE]
    3 frames
  14. Glassfish Core
    ContainerBase$StartChild.call
    1. org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)[tomcat-embed-core-8.0.32.jar:8.0.32]
    2. org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:109)[tomcat-embed-core-8.0.32.jar:8.0.32]
    3. org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4659)[tomcat-embed-core-8.0.32.jar:8.0.32]
    4. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281)[tomcat-embed-core-8.0.32.jar:8.0.32]
    5. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)[tomcat-embed-core-8.0.32.jar:8.0.32]
    6. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)[tomcat-embed-core-8.0.32.jar:8.0.32]
    7. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)[tomcat-embed-core-8.0.32.jar:8.0.32]
    7 frames
  15. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_40]
    2. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0_40]
    3. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_40]
    4. java.lang.Thread.run(Thread.java:745)[na:1.8.0_40]
    4 frames