Inject a template renderer in a servlet

yonimoses January 12, 2020

Hi,

 

I'm building a simple plugin and a servlet which handles the configuration.

I'm working with an old API (not spring/osgi) and i'm trying to inject the template render and app properties without any luck.

I keep on getting the NoClassDefFoundError.

 

my code is 

 


<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties"/>
<component-import key="templateRenderer" interface="com.atlassian.templaterenderer.TemplateRenderer"/>
<component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager"/>
<component-import key="i18nResolver" interface="com.atlassian.sal.api.message.I18nResolver"/>


<servlet name="Configuration Servlet" key="rest-configuration-servlet"
class="com.pppppp.jira.plugin.rest.sap.ConfigurationServlet">
<description key="configuration-servlet.description">Configuration Servlet for Rest endpoints</description>
<url-pattern>/com.pppppp.jira.plugin.rest.sap/configuration</url-pattern>
</servlet>





 private ApplicationProperties applicationProperties;
private TemplateRenderer renderer;
public ConfigurationServlet(TemplateRenderer templateRenderer, ApplicationProperties applicationProperties) {
this.renderer = templateRenderer;
this.applicationProperties = applicationProperties;
}
<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>

If i change the scope, the plugin fails to load all together.
I've also tried several version without any luck.

 

 





 

1 answer

0 votes
yonimoses January 13, 2020

I ended up switching to Atlassian's new api , using @Scanned .

Suggest an answer

Log in or Sign up to answer