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

Spring JIRA | Rigas Grigoropoulos | 4 years ago
  1. 0

    Spring Security and OSGi

    Stack Overflow | 4 years ago | Rigas Grigoropoulos
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'authenticationManager' must be of type [org.springframework.security.authentication.ProviderManager], but was actually of type [$Proxy94]
  2. 0

    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) {

    Spring JIRA | 4 years ago | Rigas Grigoropoulos
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'authenticationManager' must be of type [org.springframework.security.authentication.ProviderManager], but was actually of type [$Proxy94]
  3. 0

    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) {

    Spring JIRA | 4 years ago | Rigas Grigoropoulos
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'authenticationManager' must be of type [org.springframework.security.authentication.ProviderManager], but was actually of type [$Proxy94]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.springframework.beans.factory.BeanNotOfRequiredTypeException when creating a jersey service

    Stack Overflow | 3 years ago | jos
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'mClientManager' must be of type [com.vxl.service.impl.MClientManagerImpl], but was actually of type [com.sun.proxy.$Proxy134]
  6. 0

    error while injecting spring service bean into a CXF web service deployed in jboss

    Stack Overflow | 4 years ago | SGB
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'retrieveService' must be of type [com.sgb.euclid.ws.service.RetrieveService], but was actually of type [$Proxy98]

    7 unregistered visitors
    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.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()
    2. Spring Beans
      AbstractBeanFactory.getBean
      1. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:360)
      2. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      2 frames
    3. spring-security-config
      GlobalMethodSecurityBeanDefinitionParser$AuthenticationManagerDelegator.authenticate
      1. org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser$AuthenticationManagerDelegator.authenticate(GlobalMethodSecurityBeanDefinitionParser.java:386)
      1 frame