Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.templaterenderer.TemplateRenderer] found for dependency

Hi, I'm getting NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.templaterenderer.TemplateRenderer] found for dependency when I try to access my servlet in my JIRA 7 plugin.
I put below source for servlet, atlassian-plugin.xml and pom.

 

@Component
public class DialogServlet extends HttpServlet {

    private static final long serialVersionUID = 1L;
    private static final String TEMPLATE = "/dialogTemplate.vm";
    private TemplateRenderer templateRenderer;

    @Autowired
    public DialogServlet(@ComponentImport TemplateRenderer templateRenderer) {
        this.templateRenderer = templateRenderer;

    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        Map<String, Object> context = Maps.newHashMap();
        String projectName = req.getParameter("projectName");
        context.put("projectName", projectName);
        resp.setContentType("text/html;charset=utf-8");
        templateRenderer.render(TEMPLATE, context, resp.getWriter());
    }

}

 

atlassian-plugin.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
  <plugin-info>
    <description>${project.description}</description>
    <version>${project.version}</version>
    <vendor name="${project.organization.name}" url="${project.organization.url}"/>
    <param name="plugin-icon">images/pluginIcon.png</param>
    <param name="plugin-logo">images/pluginLogo.png</param>
  </plugin-info>
  <!-- add our i18n resource -->
  <resource type="i18n" name="i18n" location="reports"/>
  <!-- add our web resources -->
  <web-resource key="reports-resources" name="reports Web Resources">
    <dependency>com.atlassian.auiplugin:ajs</dependency>
    <resource type="download" name="reports.css" location="/css/reports.css"/>
    <resource type="download" name="reports.js" location="/js/reports.js"/>
    <resource type="download" name="images/" location="/images"/>
    <context>reports</context>
  </web-resource>
  <web-section name="My Links Main Section" i18n-name-key="my-links-main-section.name" key="my_links_section" location="my_links_link" weight="10">
    <description key="my-links-main-section.description">The My Links Main Section Plugin</description>
    <label key="my-links-main-section.label"/>
  </web-section>
  <web-item name="Link on My Links Main Section" i18n-name-key="linkon-my-links-main-section.name" key="my_links_link" section="system.top.navigation.bar" weight="47">
    <description key="linkon-my-links-main-section.description">The Link on My Links Main Section Plugin</description>
    <conditions type="AND">
      <condition class="com.organisation.ct.it.conditions.VisibilityCondition">
        <param name="group1" value="organisation-inventory-group"/>
      </condition>
    </conditions>
    <label key="Plugins"/>
    <link linkId="my_links_link">http://www.atlassian.com</link>
  </web-item>
  <web-item name="Generare Proces Verbal" i18n-name-key="generare-proces-verbal.name" key="website_link" section="my_links_link/my_links_section" weight="10">
    <description key="generare-proces-verbal.description">Generare Proces Verbal</description>
    <label key="generare-proces-verbal.label"/>
    <link linkId="website_link">/plugins/servlet/dialogservlet</link>
  </web-item>
  <servlet name="Dialog Servlet" i18n-name-key="dialog-servlet.name" key="dialog-servlet" class="com.organisation.ct.it.servlet.DialogServlet">
    <description key="dialog-servlet.description">The Dialog Servlet Plugin</description>
    <url-pattern>/dialogservlet</url-pattern>
  </servlet>
  <web-item name="Scanare" i18n-name-key="scanare.name" key="scanare" section="my_links_link/my_links_section" weight="1000">
    <description key="scanare.description">The Scanare Plugin</description>
    <label key="scanare.label"/>
    <link linkId="scanare-link">/plugins/servlet/scannerservlet</link>
  </web-item>
  <servlet name="Scanner Servlet" i18n-name-key="scanner-servlet.name" key="scanner-servlet" class="com.organisation.ct.it.servlet.ScannerServlet">
    <description key="scanner-servlet.description">The Scanner Servlet Plugin</description>
    <url-pattern>/scannerservlet</url-pattern>
  </servlet>
</atlassian-plugin>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.organisation.ct.it</groupId>
    <artifactId>reports</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <organization>
        <name>Example Company</name>
        <url>http://www.example.com/</url>
    </organization>
    <name>reports</name>
    <description>This is the com.organisation.ct.it:reports plugin for Atlassian JIRA.</description>
    <packaging>atlassian-plugin</packaging>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Add dependency on jira-core if you want access to JIRA implementation 
            classes as well as the sanctioned API. -->
        <!-- This is not normally recommended, but may be required eg when migrating 
            a plugin originally developed against JIRA 4.x -->
        <!-- <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-core</artifactId> 
            <version>${jira.version}</version> <scope>provided</scope> </dependency> -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>
        <!-- WIRED TEST RUNNER DEPENDENCIES -->
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
            <version>${plugin.testrunner.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.2-atlassian-1</version>
        </dependency>
        <!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
        <!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
        <!-- <dependency> <groupId>com.atlassian.jira.tests</groupId> <artifactId>jira-testkit-client</artifactId> 
            <version>${testkit.version}</version> <scope>test</scope> </dependency> -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <version>1.3.1</version>
            <scope>provided</scope>
        </dependency>
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5.6</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.version}</productDataVersion>
                    <!-- Uncomment to install TestKit backdoor in JIRA. -->
                    <!-- <pluginArtifacts> <pluginArtifact> <groupId>com.atlassian.jira.tests</groupId> 
                        <artifactId>jira-testkit-plugin</artifactId> <version>${testkit.version}</version> 
                        </pluginArtifact> </pluginArtifacts> -->
                    <enableQuickReload>true</enableQuickReload>
                    <enableFastdev>false</enableFastdev>
                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <!-- Add package to export here -->
                        <Export-Package>com.organisation.ct.it.api,</Export-Package>
                        <!-- Add package import here -->
                        <Import-Package>org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            com.atlassian.plugin.osgi.bridge.external,
                            *;resolution:=optional
                        </Import-Package>
                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>1.2.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <includeExclude>+com.atlassian.jira.plugins.issue.create.*</includeExclude>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.plugin</groupId>
                            <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                        </dependency>
                    </scannedDependencies>
                    <verbose>false</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <jira.version>7.1.4</jira.version>
        <amps.version>6.2.3</amps.version>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
        <spring.version>2.5.6</spring.version>
        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml 
            and the key to generate bundle. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <!-- TestKit version 6.x for JIRA 6.x -->
        <testkit.version>6.3.11</testkit.version>
    </properties>
</project>

 


2 answers

I ended up removing spring from my project and it worked.

1、atlas-clean

2、atlas-mvn package

3、Exception will disappear

From:UnsatisfiedDependencyException/NoSuchBeanDefinitionException for ao service

Like tarwooz likes this

Hi Oana - what do you mean remove spring? can you please explain what exactly need to do?

Hi,

Try the newest version of templaterenderer. Update your eclipse project . Are there errors

Not forget to use command like atlas-clean.

Hope this helps.

Hi,thanks for your response.

The last version of templaterenderer that i have found is 1.5.0 but unfortunatly it doens't work.

Is there a newer one?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

109 views 7 9
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you