Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Null TemplateRenderer in BaseBuildConfigurationAwarePlugin sub-class when using Spring Scanner

Chris Cormack
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 4, 2023

I have a pretty simple Bamboo plugin that was created using 'atlas-create-bamboo-plugin', however, now that I am adding some configuration I am hitting a null pointer due to 'getTemplateRenderer()' in 'BaseBuildConfigurationAwarePlugin' returning 'null'.

I have this in 'atlassian-plugin.xml':

<additionalBuildConfigurationPlugin key="configuration" class="com.orgname.bamboo.githubStatus.Configuration">
<resource type="freemarker" name="edit" location="config/edit.ftl" />
</additionalBuildConfigurationPlugin>

and com.orgname.bamboo.githubStatus.Configuration is implemented as:

package com.orgname.bamboo.githubStatus;

import
com.atlassian.bamboo.plan.Plan;
import com.atlassian.bamboo.plan.cache.ImmutablePlan;
import com.atlassian.bamboo.plan.configuration.MiscellaneousPlanConfigurationPlugin;
import com.atlassian.bamboo.v2.build.BaseBuildConfigurationAwarePlugin;

public class
Configuration extends BaseBuildConfigurationAwarePlugin implements MiscellaneousPlanConfigurationPlugin {
@Override
public boolean isApplicableTo(@NotNull ImmutablePlan immutablePlan) {
return true;
}
}

I have tried overriding 'getEditHtml()' to track down that the NPE is happening in this line (and that getTemplateRenderer() is returning null):

return this.getTemplateRenderer().render(templatePath, context);

By way of experiment, I have tried adding this to my Configuration class:

@Inject
private TemplateRenderer myInternalRenderer;

and this fails with:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.orgname.bamboo.githubStatus.Configuration': Unsatisfied dependency expressed through field 'myInternalRenderer'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.bamboo.template.TemplateRenderer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.inject.Inject()}

I am not sure where to take this from here, so any suggestions very much appreciated.

1 answer

0 votes
Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2023

Hi @Chris Cormack,

 

App development related questions are best asked in the Atlassian Developer Community, you have a greater chance to get feedback from other app developers there.

 

The question at hand seems to be appropriate for the Atlassian Developer Tools category, even though there is also a Bamboo Development category for solely Bamboo related questions. 

  • To set expectations regarding the latter, you'll note that there are comparatively few Bamboo related questions - regardless, quite some Atlassian team members are monitoring the community by now, so hopefully they can loop in someone from the Bamboo team.

 

Cheers,

Steffen

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events