org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleMongoApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.sample.data.mongo.CustomerRepository org.springframework.boot.sample.data.mongo.SampleMongoApplication.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@540984b: startup date [Sat Dec 21 19:07:22 CET 2013]; root of context hierarchy

Spring JIRA | Thibault Kruse | 3 years ago
  1. 0

    When Defining a BeanPostProcessor Bean that depends on a Mongo Repository, startup fails with complicated looking exception: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.379 sec <<< FAILURE! - in org.springframework.boot.sample.data.mongo.SampleMongoApplicationTests testDefaultSettings(org.springframework.boot.sample.data.mongo.SampleMongoApplicationTests) Time elapsed: 1.352 sec <<< ERROR! org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleMongoApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.sample.data.mongo.CustomerRepository org.springframework.boot.sample.data.mongo.SampleMongoApplication.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@540984b: startup date [Sat Dec 21 19:07:22 CET 2013]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:268) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:168) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:137) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:63) at org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getEntityInformation(MongoRepositoryFactory.java:141) at org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getTargetRepository(MongoRepositoryFactory.java:83) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:150) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:144) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) Example will be provided as pull request on spring-issues...

    Spring JIRA | 3 years ago | Thibault Kruse
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleMongoApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.sample.data.mongo.CustomerRepository org.springframework.boot.sample.data.mongo.SampleMongoApplication.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@540984b: startup date [Sat Dec 21 19:07:22 CET 2013]; root of context hierarchy
  2. 0

    When Defining a BeanPostProcessor Bean that depends on a Mongo Repository, startup fails with complicated looking exception: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.379 sec <<< FAILURE! - in org.springframework.boot.sample.data.mongo.SampleMongoApplicationTests testDefaultSettings(org.springframework.boot.sample.data.mongo.SampleMongoApplicationTests) Time elapsed: 1.352 sec <<< ERROR! org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleMongoApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.sample.data.mongo.CustomerRepository org.springframework.boot.sample.data.mongo.SampleMongoApplication.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@540984b: startup date [Sat Dec 21 19:07:22 CET 2013]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:268) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:168) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:137) at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:63) at org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getEntityInformation(MongoRepositoryFactory.java:141) at org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getTargetRepository(MongoRepositoryFactory.java:83) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:150) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:144) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) Example will be provided as pull request on spring-issues...

    Spring JIRA | 3 years ago | Thibault Kruse
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sampleMongoApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.sample.data.mongo.CustomerRepository org.springframework.boot.sample.data.mongo.SampleMongoApplication.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@540984b: startup date [Sat Dec 21 19:07:22 CET 2013]; root of context hierarchy
  3. 0

    SpringBoot application crash

    Stack Overflow | 2 years ago | Aleksandrs Rudzitis
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public lv.intrade.example.dao.TranslationDAO lv.intrade.example.services.Dictionary.translationDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'translationDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.persistence.EntityManagerFactory lv.intrade.example.dao.TranslationDAOImpl.emf; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1a666bf: startup date [Tue Dec 30 23:20:58 EET 2014]; root of context hierarchy
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    SpringBoot application crash

    Stack Overflow | 2 years ago | Aleksandrs Rudzitis
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public lv.intrade.example.dao.TranslationDAO lv.intrade.example.services.Dictionary.translationDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'translationDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.persistence.EntityManagerFactory lv.intrade.example.dao.TranslationDAOImpl.emf; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of FactoryBean's singleton object failed; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1a666bf: startup date [Tue Dec 30 23:20:58 EET 2014]; root of context hierarchy
  6. 0

    Spring ComponentScan causing java.lang.IllegalStateException: ApplicationEventMulticaster not initialized

    Stack Overflow | 1 year ago | Robin Elvin
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedServletContainerCustomizerBeanPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodSecurityConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private co.sens.rest.config.SecurityConfiguration co.sens.rest.config.MethodSecurityConfig.securityConfig; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.setContentNegotationStrategy(org.springframework.web.accept.ContentNegotiationStrategy); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.setConfigurers(java.util.List); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private co.sens.rest.controllers.UsersController co.sens.rest.controllers.web.WebController.usersController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usersController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private co.sens.data.Operations co.sens.rest.controllers.UsersController.dataOperations; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'operations': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private co.sens.docdata.DocStoreOperations co.sens.data.Operations.docStoreOperations; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'docStoreOperations': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private co.sens.docdata.repositories.UserRepository co.sens.docdata.DocStoreOperations.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@553a3d88: startup date [Fri Jul 10 08:55:21 BST 2015]; root of context hierarchy

    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 'sampleMongoApplication': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.sample.data.mongo.CustomerRepository org.springframework.boot.sample.data.mongo.SampleMongoApplication.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@540984b: startup date [Sat Dec 21 19:07:22 CET 2013]; root of context hierarchy

      at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster()
    2. Spring Context
      AbstractApplicationContext.publishEvent
      1. org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:346)
      2. org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
      2 frames
    3. Spring Data Core
      AbstractMappingContext.getPersistentEntity
      1. org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:268)
      2. org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:168)
      3. org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:137)
      4. org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:63)
      4 frames
    4. Spring Data MongoDB - Core
      MongoRepositoryFactory.getTargetRepository
      1. org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getEntityInformation(MongoRepositoryFactory.java:141)
      2. org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getTargetRepository(MongoRepositoryFactory.java:83)
      2 frames
    5. Spring Data Core
      RepositoryFactoryBeanSupport.getObject
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:150)
      2. org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162)
      3. org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44)
      3 frames
    6. Spring Beans
      AbstractBeanFactory.getBean
      1. org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:144)
      2. org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
      3. org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1514)
      4. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
      5. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
      5 frames