org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionBeanWithDefaultProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.inject.Provider com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider; nested exception is java.lang.IllegalArgumentException: Can not set javax.inject.Provider field com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider to com.sopovs.moradanen.PrototypeBean

Spring JIRA | Ivan Sopov | 4 years ago
  1. 0

    If I inject javax.inject.Provider for creating prototype scoped beans into session scoped beans it fails when creating second session: 2012-10-01 18:45:50.113:WARN::/pins/default org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionBeanWithDefaultProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.inject.Provider com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider; nested exception is java.lang.IllegalArgumentException: Can not set javax.inject.Provider field com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider to com.sopovs.moradanen.PrototypeBean at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 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) at org.springframework.web.context.request.SessionScope.get(SessionScope.java:92) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818) at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectFactory.getObject(DefaultListableBeanFactory.java:1040) at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyProvider.get(DefaultListableBeanFactory.java:1056) at com.sopovs.moradanen.DefaultProviderController.sayHello(DefaultProviderController.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)... I have created sample project reproducing the issue and published it on github: https://github.com/isopov/provider-in-session-with-spring

    Spring JIRA | 4 years ago | Ivan Sopov
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionBeanWithDefaultProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.inject.Provider com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider; nested exception is java.lang.IllegalArgumentException: Can not set javax.inject.Provider field com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider to com.sopovs.moradanen.PrototypeBean
  2. 0

    If I inject javax.inject.Provider for creating prototype scoped beans into session scoped beans it fails when creating second session: 2012-10-01 18:45:50.113:WARN::/pins/default org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionBeanWithDefaultProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.inject.Provider com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider; nested exception is java.lang.IllegalArgumentException: Can not set javax.inject.Provider field com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider to com.sopovs.moradanen.PrototypeBean at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 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) at org.springframework.web.context.request.SessionScope.get(SessionScope.java:92) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818) at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectFactory.getObject(DefaultListableBeanFactory.java:1040) at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyProvider.get(DefaultListableBeanFactory.java:1056) at com.sopovs.moradanen.DefaultProviderController.sayHello(DefaultProviderController.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)... I have created sample project reproducing the issue and published it on github: https://github.com/isopov/provider-in-session-with-spring

    Spring JIRA | 4 years ago | Ivan Sopov
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionBeanWithDefaultProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.inject.Provider com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider; nested exception is java.lang.IllegalArgumentException: Can not set javax.inject.Provider field com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider to com.sopovs.moradanen.PrototypeBean
  3. 0

    Exception : Error creating bean with name 'richBean'

    Stack Overflow | 3 years ago | user3398225
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'richBean': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: javax.enterprise.event.Event org.barApp.web.jsf.RichBean.pushEvent; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [javax.enterprise.event.Event] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject(), @org.richfaces.cdi.push.Push(subtopic=, topic=pushCdi)}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Eclipse Community Forums: Eclipse Process Manager (Stardust) ยป javax.mail.Authenticator ClassNotFoundException for external smtp server

    eclipse.org | 5 months ago
    javax.faces.FacesException: Problem in renderResponse: /file:/Users/apple/services-ws/kontiki/services/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/VendorManagementPortal/WEB-INF/lib/ipp-views-common.jar!/META-INF/xhtml/login.xhtml @28,68 test="#{ippLoginDialog.pluginLoginStyleSheetPath !=null}" Error creating bean with name 'ippLoginDialog' defined in URL [jar:file:/Users/apple/services-ws/kontiki/services/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/VendorManagementPortal/WEB-INF/lib/ipp-views-common.jar!/META-INF/spring/ui-common-ipp-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/mail/Authenticator
  6. 0

    Injection of autowired dependencies failed (Spring forum at Coderanch)

    coderanch.com | 5 months ago
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.batchReader': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.abc.batch.dao.FileMetadataDAO com.abc.batch.reader.SampleReader.metaData; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'jdbcFileMetaDataDAO' is defined

  1. marcbouvierdav 2 times, last 3 months ago
  2. andyglick 12 times, last 9 months ago
1 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.BeanCreationException

    Error creating bean with name 'sessionBeanWithDefaultProvider': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.inject.Provider com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider; nested exception is java.lang.IllegalArgumentException: Can not set javax.inject.Provider field com.sopovs.moradanen.SessionBeanWithDefaultProvider.prototypePojoProvider to com.sopovs.moradanen.PrototypeBean

    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues()
  2. Spring Beans
    AbstractBeanFactory$2.getObject
    1. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
    3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    5. org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:332)
    5 frames
  3. Spring
    SessionScope.get
    1. org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
    2. org.springframework.web.context.request.SessionScope.get(SessionScope.java:92)
    2 frames
  4. Spring Beans
    DefaultListableBeanFactory$DependencyProvider.get
    1. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:328)
    2. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    3. org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876)
    4. org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
    5. org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectFactory.getObject(DefaultListableBeanFactory.java:1040)
    6. org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyProvider.get(DefaultListableBeanFactory.java:1056)
    6 frames
  5. com.sopovs.moradanen
    DefaultProviderController.sayHello
    1. com.sopovs.moradanen.DefaultProviderController.sayHello(DefaultProviderController.java:19)
    1 frame