Bamboo Plugin Manager Injection Causing NoSuchBeanDefinitionException

While creating a plugin for Bamboo using the atlas-sdk, previously I was able to inject managers using this format

    @BambooImport
    private ResultsSummaryManager resultsSummaryManager;
    @Autowire
    public void setResultsSummaryManager(@BambooImport ResultsSummaryManager resultsSummaryManager){
     this.resultsSummaryManager= resultsSummaryManager;
   }

However, after updating sdk this this causes this exception to happen

022-04-24 14:48:27,673 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-26-thread-50] [AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.bamboo.event.BuildFinishedEvent[source=com.atlassian.bamboo.build.DefaultBuildExecutionManager@6bd0d4] job=TEST-TESP0-JOB1 #3] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.bamboo.chains.ChainExecutionManagerImpl.onBuildFinished(com.atlassian.bamboo.event.BuildFinishedEvent), listener=com.atlassian.bamboo.chains.ChainExecutionManagerImpl@46a95661}]
java.lang.RuntimeException: Error creating bean with name 'com.myPlugin2.plugins.BuildComplete': Unsatisfied dependency expressed through field 'resultsSummaryManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.bamboo.resultsummary.ResultsSummaryManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @com.atlassian.plugin.spring.scanner.annotation.imports.BambooImport(value=)}. Listener: com.atlassian.bamboo.chains.ChainExecutionManagerImpl event: com.atlassian.bamboo.event.BuildFinishedEvent
	at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:57)
	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.myPlugin2.plugins.BuildComplete': Unsatisfied dependency expressed through field 'resultsSummaryManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.bamboo.resultsummary.ResultsSummaryManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @com.atlassian.plugin.spring.scanner.annotation.imports.BambooImport(value=)}
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:598)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:376)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:351)
	at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor.createBean(DefaultSpringContainerAccessor.java:116)
	at com.atlassian.plugin.module.ClassPrefixModuleFactory.createModule(ClassPrefixModuleFactory.java:35)
	at com.atlassian.plugin.module.PrefixDelegatingModuleFactory.createModule(PrefixDelegatingModuleFactory.java:88)
	at com.atlassian.bamboo.plugin.descriptor.AbstractBambooModuleDescriptor.createModule(AbstractBambooModuleDescriptor.java:26)
	at com.atlassian.bamboo.plugin.descriptor.AbstractBambooModuleDescriptor.access$000(AbstractBambooModuleDescriptor.java:17)
	at com.atlassian.bamboo.plugin.descriptor.AbstractBambooModuleDescriptor$2.call(AbstractBambooModuleDescriptor.java:91)
	at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(BambooPluginUtils.java:55)
	at com.atlassian.bamboo.plugin.descriptor.AbstractBambooModuleDescriptor.getModule(AbstractBambooModuleDescriptor.java:99)
	at com.atlassian.bamboo.chains.ChainPluginSupportImpl.getActionsForModuleDescriptor(ChainPluginSupportImpl.java:296)
	at com.atlassian.bamboo.chains.ChainPluginSupportImpl.chainCompleted(ChainPluginSupportImpl.java:133)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.orm.hibernate5.support.OpenSessionInterceptor.invoke(OpenSessionInterceptor.java:90)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
	at com.sun.proxy.$Proxy254.chainCompleted(Unknown Source)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.finaliseChainStateIfChainExecutionHasCompleted(ChainExecutionManagerImpl.java:1139)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.access$1700(ChainExecutionManagerImpl.java:136)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$3.run(ChainExecutionManagerImpl.java:685)
	at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:302)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.execute(ChainExecutionManagerImpl.java:600)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.access$1300(ChainExecutionManagerImpl.java:136)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2$1.run(ChainExecutionManagerImpl.java:454)
	at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:302)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.run(ChainExecutionManagerImpl.java:439)
	at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:302)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.onBuildFinished(ChainExecutionManagerImpl.java:425)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:42)
	... 8 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.bamboo.resultsummary.ResultsSummaryManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @com.atlassian.plugin.spring.scanner.annotation.imports.BambooImport(value=)}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1662)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1221)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1175)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:595)
	... 54 more

Any help will be appreciated as this breaks the whole plugin in development

1 Like

Resolved this using this post

3 Likes