Inject BambooUserManager in bamboo task

Øivind Boge July 14, 2014

Hi.

I have developed a Bamboo task plugin which also consists of a TaskConfigurator, and they both need the BambooUserManager which is injected through the constructor in both classes, and in my atlassian-plugin.xml I have the following:

<component-import key="bambooUserManager" interface="com.atlassian.bamboo.user.BambooUserManager"/>

So while developing and testing in my local test environment (launched by atlas-run) everything works perfectly. However when I installed the plugin in our production environment I got the following exception:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.ec.plugins.bamboo.task.MailNotificationTask': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.bamboo.user.BambooUserManager]: : No unique bean of type [com.atlassian.bamboo.user.BambooUserManager] is defined: Unsatisfied dependency of type [interface com.atlassian.bamboo.user.BambooUserManager]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.bamboo.user.BambooUserManager] is defined: Unsatisfied dependency of type [interface com.atlassian.bamboo.user.BambooUserManager]: expected at least 1 matching bean

I have also tried with some anotations, however I do not know if this is correct:

@Resource(name="bambooUserManager")
	private BambooUserManager bambooUserManager;
	
	/**
	 * Constructs the task executable
	 */
	public MailNotificationTask(BambooUserManager bambooUserManager) {
		this.bambooUserManager = bambooUserManager;
	}

Somebody got any ideas why this is working on my local test environment and not in the production environment? They are both running Bamboo version 5.5.0.

Also, the configuration on the production server is working. So the BambooUserManager is successfully injected into the TaskConfigurator.

Thanks in advance for any reply!

Øivind Boge

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Øivind Boge July 14, 2014

Was caused by the task running on a remote agent

TAGS
AUG Leaders

Atlassian Community Events