Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1115

RepositoryBeanNameGenerator fails to resolve bean names for custom implementations detected via Spring's component index

    XMLWordPrintable

    Details

      Description

      After upgrading to Spring Boot 2.0.0.M2 and Spring Data Kay.M4 I cannot start my microservices any more which are accessing MongoDB. A testcase is appended to produce the stacktrace below.
      First I thought it is a Spring Boot issue https://github.com/spring-projects/spring-boot/issues/9780
      Stacktrace:

      C:\Users\ziju0001\IdeaProjects\testcase>gradle
      
      > Task :bootRun
      
        .   ____          _            __ _ _
       /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
      ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
       \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
        '  |____| .__|_| |_|_| |_\__, | / / / /
       =========|_|==============|___/=/_/_/_/
       :: Spring Boot ::             (v2.0.0.M2)
      
      2017-07-18 20:03:31.441  INFO 8572 --- [           main] de.hska.test.Main                        : Starting Main on iwi-w-ziju01-d with PID 8572 (C:\Users\ziju0001\IdeaProjects\testcase\build\classes\java\main started by ziju0001 in C:\Users\ziju0001\IdeaProjects\testcase)
      2017-07-18 20:03:31.441  INFO 8572 --- [           main] de.hska.test.Main                        : No active profile set, falling back to default profiles: default
      2017-07-18 20:03:31.551  INFO 8572 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@402e37bc: startup date [Tue Jul 18 20:03:31 CEST 2017]; root of context hierarchy
      2017-07-18 20:03:33.051 ERROR 8572 --- [           main] o.s.boot.SpringApplication               : Application startup failed
      
      java.lang.NullPointerException: null
              at org.springframework.data.repository.config.RepositoryBeanNameGenerator.getRepositoryInterfaceFromFactory(RepositoryBeanNameGenerator.java:81) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.data.repository.config.RepositoryBeanNameGenerator.getRepositoryInterfaceFrom(RepositoryBeanNameGenerator.java:75) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.data.repository.config.RepositoryBeanNameGenerator.generateBeanName(RepositoryBeanNameGenerator.java:52) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.data.repository.config.RepositoryConfigurationSourceSupport.generateBeanName(RepositoryConfigurationSourceSupport.java:92) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.data.repository.config.DefaultRepositoryConfiguration.getImplementationBeanName(DefaultRepositoryConfiguration.java:109) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder.registerCustomImplementation(RepositoryBeanDefinitionBuilder.java:150) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.data.repository.config.RepositoryBeanDefinitionBuilder.build(RepositoryBeanDefinitionBuilder.java:120) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:120) ~[spring-data-commons-2.0.0.M4.jar:na]
              at org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport.registerBeanDefinitions(AbstractRepositoryConfigurationSourceSupport.java:60) ~[spring-boot-autoconfigure-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$0(ConfigurationClassBeanDefinitionReader.java:355) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_131]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:354) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:229) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:122) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:136) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at de.hska.test.Main.main(Main.java:13) [main/:na]
      
      2017-07-18 20:03:33.051  INFO 8572 --- [           main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@402e37bc: startup date [Tue Jul 18 20:03:31 CEST 2017]; root of context hierarchy
      2017-07-18 20:03:33.066  WARN 8572 --- [           main] ConfigServletWebServerApplicationContext : Exception thrown from LifecycleProcessor on context close
      
      java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@402e37bc: startup date [Tue Jul 18 20:03:31 CEST 2017]; root of context hierarchy
              at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:426) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:996) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:955) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:808) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:136) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at de.hska.test.Main.main(Main.java:13) [main/:na]
      
      2017-07-18 20:03:33.066 ERROR 8572 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
      
      java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@402e37bc: startup date [Tue Jul 18 20:03:31 CEST 2017]; root of context hierarchy
              at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:413) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:236) ~[spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:581) [spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:557) [spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:944) [spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:526) [spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:951) [spring-beans-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1027) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1003) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:955) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
              at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:808) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:136) [spring-boot-2.0.0.M2.jar:2.0.0.M2]
              at de.hska.test.Main.main(Main.java:13) [main/:na]
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              juergen.zimmermann Juergen Zimmermann
              Last updater:
              Oliver Drotbohm
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: