org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter

Spring JIRA | Andy Wilkinson | 11 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    This is a follow on from SPR-13968. I have just encountered a {{NoUniqueBeanDefinitionException}} that was the cause of a {{BeanInstantiationException}}: {noformat} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:841) ~[spring-context-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540) ~[spring-context-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:765) [classes/:na] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [classes/:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [classes/:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1182) [classes/:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1171) [classes/:na] at com.example.Gh5682Application.main(Gh5682Application.java:12) [classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] ... 17 common frames omitted Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter at org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique(DependencyDescriptor.java:172) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1059) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfAvailable(DefaultListableBeanFactory.java:1544) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration.<init>(SpringApplicationAdminJmxAutoConfiguration.java:63) ~[classes/:na] at org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574.<init>(<generated>) ~[classes/:na] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_60] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_60] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_60] at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_60] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] ... 19 common frames omitted {noformat} For Boot's failure analysis, it would be useful to be able to access the {{Constructor}} that was called from the {{BeanInstantiationException}}.

    Spring JIRA | 11 months ago | Andy Wilkinson
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter
  2. 0

    This is a follow on from SPR-13968. I have just encountered a {{NoUniqueBeanDefinitionException}} that was the cause of a {{BeanInstantiationException}}: {noformat} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:841) ~[spring-context-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540) ~[spring-context-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:765) [classes/:na] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [classes/:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [classes/:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1182) [classes/:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1171) [classes/:na] at com.example.Gh5682Application.main(Gh5682Application.java:12) [classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] ... 17 common frames omitted Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter at org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique(DependencyDescriptor.java:172) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1059) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfAvailable(DefaultListableBeanFactory.java:1544) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] at org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration.<init>(SpringApplicationAdminJmxAutoConfiguration.java:63) ~[classes/:na] at org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574.<init>(<generated>) ~[classes/:na] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_60] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_60] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_60] at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_60] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ~[spring-beans-4.3.0.RC1.jar:4.3.0.RC1] ... 19 common frames omitted {noformat} For Boot's failure analysis, it would be useful to be able to access the {{Constructor}} that was called from the {{BeanInstantiationException}}.

    Spring JIRA | 11 months ago | Andy Wilkinson
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter
  3. 0

    Multiple MBeanExporter are created

    GitHub | 11 months ago | romainmoreau
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$5b336419]: Constructor threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Custom ObjectMapper issue with Spring Boot 1.4.0 M2 & M3

    GitHub | 10 months ago | dlewis1788
    org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.fasterxml.jackson.databind.ObjectMapper] is defined: expected single matching bean but found 4: distillerObjectMapper,objectMapper,halObjectMapper,_halObjectMapper

    Root Cause Analysis

    1. org.springframework.beans.factory.NoUniqueBeanDefinitionException

      No qualifying bean of type [org.springframework.jmx.export.MBeanExporter] is defined: expected single matching bean but found 2: mbeanExporter,endpointMBeanExporter

      at org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique()
    2. Spring Beans
      DefaultListableBeanFactory$DependencyObjectProvider.getIfAvailable
      1. org.springframework.beans.factory.config.DependencyDescriptor.resolveNotUnique(DependencyDescriptor.java:172)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      2. org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1059)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      3. org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfAvailable(DefaultListableBeanFactory.java:1544)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      3 frames
    3. org.springframework.boot
      SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574.<init>
      1. org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration.<init>(SpringApplicationAdminJmxAutoConfiguration.java:63)[classes/:na]
      2. org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$a2ce2574.<init>(<generated>)[classes/:na]
      2 frames
    4. Java RT
      Constructor.newInstance
      1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[na:1.8.0_60]
      2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[na:1.8.0_60]
      3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[na:1.8.0_60]
      4. java.lang.reflect.Constructor.newInstance(Constructor.java:422)[na:1.8.0_60]
      4 frames
    5. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      2. org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      3. org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      6. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      7. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      8. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      9. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      10. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      11. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      12. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:775)[spring-beans-4.3.0.RC1.jar:4.3.0.RC1]
      12 frames
    6. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:841)[spring-context-4.3.0.RC1.jar:4.3.0.RC1]
      2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540)[spring-context-4.3.0.RC1.jar:4.3.0.RC1]
      2 frames
    7. Spring Boot
      SpringApplication.run
      1. org.springframework.boot.SpringApplication.refresh(SpringApplication.java:765)[classes/:na]
      2. org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)[classes/:na]
      3. org.springframework.boot.SpringApplication.run(SpringApplication.java:314)[classes/:na]
      4. org.springframework.boot.SpringApplication.run(SpringApplication.java:1182)[classes/:na]
      5. org.springframework.boot.SpringApplication.run(SpringApplication.java:1171)[classes/:na]
      5 frames
    8. com.example
      Gh5682Application.main
      1. com.example.Gh5682Application.main(Gh5682Application.java:12)[classes/:na]
      1 frame