org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'authenticationManager' must be of type [org.springframework.security.authentication.ProviderManager], but was actually of type [$Proxy94]

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.

  • Spring Security and OSGi
    via Stack Overflow by Rigas Grigoropoulos
    ,
  • In the authenticate method of the AuthenticationManagerDelegator inner class, it is attempted to get a bean of class org.springframework.security.authentication.ProviderManager. In the Eclipse Virgo container when the AuthenticationManager is referenced as a service, the ProviderManager will be wrapped inside a Proxy class and the following Exception will be thrown: Failed to call secure method org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'authenticationManager' must be of type [org.springframework.security.authentication.ProviderManager], but was actually of type [$Proxy94] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:360) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser$AuthenticationManagerDelegator.authenticate(GlobalMethodSecurityBeanDefinitionParser.java:386) The bean should be looked up by the org.springframework.security.authentication.AuthenticationManager interface. The following change works properly for the described scenario. Original code (at line 386): try { delegate = beanFactory.getBean(authMgrBean, ProviderManager.class); } catch (NoSuchBeanDefinitionException e) { Changed to: try { delegate = beanFactory.getBean(authMgrBean, AuthenticationManager.class); } catch (NoSuchBeanDefinitionException e) {
    via by Rigas Grigoropoulos,
  • In the authenticate method of the AuthenticationManagerDelegator inner class, it is attempted to get a bean of class org.springframework.security.authentication.ProviderManager. In the Eclipse Virgo container when the AuthenticationManager is referenced as a service, the ProviderManager will be wrapped inside a Proxy class and the following Exception will be thrown: Failed to call secure method org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'authenticationManager' must be of type [org.springframework.security.authentication.ProviderManager], but was actually of type [$Proxy94] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:360) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser$AuthenticationManagerDelegator.authenticate(GlobalMethodSecurityBeanDefinitionParser.java:386) The bean should be looked up by the org.springframework.security.authentication.AuthenticationManager interface. The following change works properly for the described scenario. Original code (at line 386): try { delegate = beanFactory.getBean(authMgrBean, ProviderManager.class); } catch (NoSuchBeanDefinitionException e) { Changed to: try { delegate = beanFactory.getBean(authMgrBean, AuthenticationManager.class); } catch (NoSuchBeanDefinitionException e) {
    via by Rigas Grigoropoulos,
  • Security annotation - can't secure
    via Stack Overflow by fatnjazzy
    ,
  • Unable to run legacy tests
    via GitHub by jefffischer
    ,
    • org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'authenticationManager' must be of type [org.springframework.security.authentication.ProviderManager], but was actually of type [$Proxy94] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:360) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser$AuthenticationManagerDelegator.authenticate(GlobalMethodSecurityBeanDefinitionParser.java:386)

    Users with the same issue

    Unknown visitor2 times, last one,
    pulse00
    pulse002 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    4 more bugmates