How to use TemplateRenderer in JIRA7 Plugin



I am not sure if I am doing something wrong but I am getting errors while trying to use TemplateRenderer in JIRA7 plugin development.

Here is the exception

Unable to create new reference 
my-servlet (null), 
[INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference$InitializationException: 
java.lang.NoClassDefFoundError: com/atlassian/templaterenderer/TemplateRenderer
Caused by: java.lang.ClassNotFoundException: com.atlassian.templaterenderer.TemplateRenderer not found by com.mycompany.helloworld [204]


Here is the dependency I defined to pom.xml



Component import in atlassian-plugin.xml

<component-import key="templateRenderer" 
    interface="com.atlassian.templaterenderer.TemplateRenderer" />


And the servlet's get method

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
	final Map<String, Object> context = initVelocityContext(resp);
	renderer.render(TEMPLATE_PATH, context, resp.getWriter());


Any comment would be much appreciated.



3 answers

1 accepted

1 vote
Answer accepted

Mystery is gone,

I faced all problems again just after switching to a PostgreSql database from H2. So, everything worked because I did not try it with Postgre.

Here was the first error

jira Constructor threw exception; nested exception is java.lang.NoSuchMethodError:[Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet


Then I remembered that in JIRA 7, guava version changed to 18.0

This is the problem. PostgreSql driver's dependency guava overrides JIRA's guava.

I added an exclusion as below



Now, I have running JIRA 7 with my running add-ons.


Thanks for anyone tried to help.

Thanks! Seems to work! Where did you find this info?

Almost three years passed, I do not remember :)

What I remember is, it was a very bad headache


What you have in atlassian-plugin.xml seems fine. I am doing this in more less the same way and it works. As usual, the devil is in the details. Do you have an Import-Package for com.atlassian.templaterenderer.* package in your maven-jira-plugin configuration? 

You can also see how this is used in the class WebHookAdminServlet from this repository

Thanks for your kind response Filip, pom.xml does not have com.atlassian.templaterenderer.* in Import-Package element. Does it have to? Actually, there was nothing wrong before I tried to add JIRA 7 support. I am not sure but I think Spring bean scanner does not run for my add-on.

This is relatively easy to configure sprint bean scanner badly :) It didn't work for me for the first time. Can you show me your MANIFEST or at least ensure that in MANIFEST.MF there is an import for com.atlassian.templaterenderer.* There should be in my opinion, using <component-import> doesn't make this Import appear automatically.

I can share whole MANIFEST.MF but shortly I can say there is one templaterenderer. ", lassian.sal.api.transaction;resolution:=optional;version="[3.0,4)",co m.atlassian.sal.api.user;resolution:=optional;version="[3.0,4)",com.a tlassian.templaterenderer;resolution:=optional;version="[1.0,2)",com. atlassian.upm.api.license;resolution:=optional In the meantime I am trying to do something and now I get following exception. Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.mycompany.helloworld [178]: Unable to resolve 178.0: missing requirement [178.0] osgi.wiring.package; (&(osgi.wiring.package=com.atlassian.templaterenderer)(version>=1.0.0)(!(version>=2.0.0)))

0 votes

Hi again,

I think I finally succeeded on injecting services. I really did many many things but as far as I remember

  • I gave up using atlassian-spring-scanner-annotation and atlassian-spring-scanner-runner
  • Added spring libraries to dependencies (spring-osgi-core, spring-beans)
  • Added guava 18.0 to dependencies
  • Import-Package = *;version="0";resolution:=optional

I am not sure which had the affect but I am scared to rollback all I did and understand which is the right step.

However, now I have the exact same problem as this (

Creating issue within integration test fails. Actually I ran into this problem before (while migrating to 6.4.x) and I switched back to 6.3.x Now I have 7.0.0-1 and the same problem rises.

At the moment I can not run my tests which have create/update issue cases. Are you aware of this problem? Is that a bug or am I missing something?

Thanks for your interest

Looking forward to your response


Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Agile

Managing Projects in Several Jiras at the Same Time

Have you ever noticed that fixing specific problems might be a door opener for a bigger challenge, affecting a wider audience? This was exactly the case when we, as a service company working with mul...

90 views 1 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you