org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest

Spring JIRA | Viktor Khoroshko | 5 years ago
  1. 0

    Session scoped bean DefaultOAuth2ClientContext can't be created when it's constructor dependency request scoped AccessTokenRequest bean has parameters set We're trying to use Oauth2RestTemplate. We currently use the latest version of the spring-security-ouath2 - 1.0.0.m6d. The problem is that when OAuthRestTemplate is used for a first time - the session scoped DefaultOAuth2ClientContext bean is created successfully only if it's constructor dependency AccessTokenRequest request scoped bean doesn't have parameters set. But in our scenario we can pass access token request parameters (code, state) just right before OAuthRestTemplate is used for a first time. This issue is caused by the MapToMapConverter which just can't convert AccessTokenRequest proxy to the AccessTokenRequest interface constructor-arg of the DefaultOAuth2ClientContext class. As the MapToMapConverter tries to convert only when !sourceMap.isEmpty() that's why we only have this issue when AccessTokenRequest has request parameters set, Here is the stack trace: {noformat} org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:779) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:131) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43) {noformat}

    Spring JIRA | 5 years ago | Viktor Khoroshko
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest
  2. 0

    Session scoped bean DefaultOAuth2ClientContext can't be created when it's constructor dependency request scoped AccessTokenRequest bean has parameters set We're trying to use Oauth2RestTemplate. We currently use the latest version of the spring-security-ouath2 - 1.0.0.m6d. The problem is that when OAuthRestTemplate is used for a first time - the session scoped DefaultOAuth2ClientContext bean is created successfully only if it's constructor dependency AccessTokenRequest request scoped bean doesn't have parameters set. But in our scenario we can pass access token request parameters (code, state) just right before OAuthRestTemplate is used for a first time. This issue is caused by the MapToMapConverter which just can't convert AccessTokenRequest proxy to the AccessTokenRequest interface constructor-arg of the DefaultOAuth2ClientContext class. As the MapToMapConverter tries to convert only when !sourceMap.isEmpty() that's why we only have this issue when AccessTokenRequest has request parameters set, Here is the stack trace: {noformat} org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:779) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:131) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332) at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43) {noformat}

    Spring JIRA | 5 years ago | Viktor Khoroshko
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest
  3. 0

    Vraptor 3 + JPA

    com.br | 1 year ago
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rematriculaController': Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.explorenet.speech.dao.AlunoDAO]: : Error creating bean with name 'alunoDAO': Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : No matching bean of type [javax.persistence.EntityManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.persistence.EntityManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alunoDAO': Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : No matching bean of type [javax.persistence.EntityManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.persistence.EntityManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate 4.1.9 Final + Vraptor 3.4.1

    com.br | 1 year ago
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'indexController': Unsatisfied dependency expressed through constructor argument with index 4 of type [br.com.sgi.repositories.UsuarioRepository]: : Error creating bean with name 'usuarioRepositoryImpl': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.Session]: : Error creating bean with name 'br.com.caelum.vraptor.plugin.hibernate4.SessionCreator': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionCreator': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.SessionFactory]: : No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'br.com.caelum.vraptor.plugin.hibernate4.SessionCreator': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionCreator': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.SessionFactory]: : No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'usuarioRepositoryImpl': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.Session]: : Error creating bean with name 'br.com.caelum.vraptor.plugin.hibernate4.SessionCreator': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionCreator': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.SessionFactory]: : No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'br.com.caelum.vraptor.plugin.hibernate4.SessionCreator': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionCreator': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.SessionFactory]: : No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [br.com.caelum.vraptor.util.hibernate.SessionFactoryCreator, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]
  6. 0

    Vraptor 3 - Hibernate 4

    com.br | 1 year ago
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hibernateTransactionInterceptor': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.Session]: : Error creating bean with name 'br.com.caelum.vraptor.plugin.hibernate4.SessionCreator': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionCreator': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.SessionFactory]: : No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [sessionFactory, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [sessionFactory, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'br.com.caelum.vraptor.plugin.hibernate4.SessionCreator': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionCreator': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.hibernate.SessionFactory]: : No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [sessionFactory, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.hibernate.SessionFactory] is defined: expected single matching bean but found 2: [sessionFactory, br.com.caelum.vraptor.plugin.hibernate4.SessionFactoryCreator]

  1. tvrmsmith 1 times, last 1 week ago
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.UnsatisfiedDependencyException

    Error creating bean with name 'scopedTarget.org.springframework.security.oauth2.client.context.DefaultOAuth2ClientContext#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Could not convert constructor argument value of type [$Proxy244] to required type [org.springframework.security.oauth2.client.token.AccessTokenRequest]: Failed to convert value of type '$Proxy244 implementing org.springframework.security.oauth2.client.token.AccessTokenRequest,java.io.Serializable,org.springframework.aop.scope.ScopedObject,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.security.oauth2.client.token.AccessTokenRequest'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type $Proxy244<?, ?> to type org.springframework.security.oauth2.client.token.AccessTokenRequest<java.lang.String, java.util.List<?>> for value 'org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest@96ea788'; nested exception is java.lang.IllegalArgumentException: Unsupported Map interface: org.springframework.security.oauth2.client.token.AccessTokenRequest

    at org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments()
  2. Spring Beans
    AbstractBeanFactory$2.getObject
    1. org.springframework.beans.factory.support.ConstructorResolver.resolvePreparedArguments(ConstructorResolver.java:779)
    2. org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:131)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927)
    5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    6. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    7. org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332)
    7 frames
  3. Spring
    AbstractRequestAttributesScope.get
    1. org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
    1 frame