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

Freemarker Exception - freemarker.core.InvalidReferenceException: Expression uiConfigBean is undefined

Kaja Mohideen June 25, 2013

Hi there,

I've new to Bamboo plugin development, so I have started to develop a Task type Plugin for Bamboo based on the example provided, which just prints a message into build log. I've added a Executable Type to it and want the user to select the Capability to be used by the Task. I have followed steps provided in Tasks Overview page. But, I'm getting the exception from freemarker. I'm new to Freemarker. Please guide on how to resolve this issue.

Thanks in advance,

Exception from log.

2013-06-26 14:20:17,378 ERROR [qtp690739569-139] [runtime] Expression uiConfigBean is undefined on line 2, column 104 in editBuildTask.ftl.

Expression uiConfigBean is undefined on line 2, column 104 in editBuildTask.ftl.
The problematic instruction:
----------
==> user-directive ww.select [on line 2, column 1 in editBuildTask.ftl]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression uiConfigBean is undefined on line 2, column 104 in editBuildTask.ftl.
	at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
	at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
	at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
	at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
	at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:87)
	at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
	at freemarker.core.DefaultToExpression._getAsTemplateModel(DefaultToExpression.java:100)
	at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:132)
	at freemarker.core.Environment.visit(Environment.java:210)
	at freemarker.core.MixedContent.accept(MixedContent.java:92)
	at freemarker.core.Environment.visit(Environment.java:210)
	at freemarker.core.Environment.process(Environment.java:190)
	at freemarker.template.Template.process(Template.java:289)
	at freemarker.template.Template.process(Template.java:243)
	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderPage(BambooFreemarkerManager.java:465)
	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderPage(BambooFreemarkerManager.java:385)
	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderTemplateToString(BambooFreemarkerManager.java:631)
	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderPage(BambooFreemarkerManager.java:351)
	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.render(BambooFreemarkerManager.java:338)
	at com.atlassian.bamboo.ww2.actions.build.admin.config.task.TaskUIConfigBean.renderEditHtml(TaskUIConfigBean.java:112)
	at com.atlassian.bamboo.ww2.actions.build.admin.config.task.TaskUIConfigBean.prepareEditHtml(TaskUIConfigBean.java:90)
	at com.atlassian.bamboo.ww2.actions.build.admin.config.task.ConfigureBuildTasks.prepareEditHtml(ConfigureBuildTasks.java:152)
	at com.atlassian.bamboo.ww2.actions.build.admin.config.task.EditTask.doInput(EditTask.java:67)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
pmayhew May 25, 2015

Finally got it working, but the setUIConfigBean or setUIConfigSupport methods are never called, instead the uiConfigBean was instantiated through the constructor. Mine looks like public MyTaskConfigurator(PluginSettingsFactory pluginSettingsFactory, UIConfigSupport uiConfigBean) None of the other plugins did it like this, but it's working on 5.8

Thorn Golden August 16, 2018

Did you have to do anything else to make that bean injectable? On 6.6.x I get a Spring wiring exception stating there's no qualifying bean of that type.

0 votes
pmayhew May 24, 2015

I've added the context.put in both populate methods, yet I still get an exception when trying to access in my FTL.  Why would the dependency injection not be working?  I can't see any way to debug the problem either unless the setUiConfigBean() method isn't being called.

 

Update:

When populateContextForCreate() is called my uiConfigBean is NULL.  Which would imply the method below is never being called.

public void setUiConfigBean( final UIConfigSupport uiConfigBean )
{
this.uiConfigBean = uiConfigBean;
}

 

pmayhew May 24, 2015

I've also tried using setUiConfigSupport() which some plugins use, but same result

0 votes
Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 31, 2014

In, your TaskConfigurator class, in populateContextForCreate and populateContextForEdit you need to add:

context.put("uiConfigBean", uiConfigBean); //assuming context is the name of the parameter

Background: those 2 methods defined variables that can be used during rendering of tasks's FTL pages. If you need to access a bean from ftl you need to add it to context.

The reference to uiConfigBean is acquired thanks to dependency injection: just define the field and the setter on your configurator class.

0 votes
Deleted user August 31, 2014

Have you had any more progress on this? I am facing exactly the same issue with uiConfigBean not being found, following the examples exactly.

0 votes
Deleted user August 31, 2014

Have you had any more progress on this? I am facing exactly the same issue with uiConfigBean not being found, following the examples exactly.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events