Error
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.accelq.plugins.jira.providers.AQIssueConnect': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.sal.api.pluginsettings.PluginSettingsFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:378)
at jdk.internal.reflect.GeneratedMethodAccessor179.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor.createBean(DefaultSpringContainerAccessor.java:118)
at com.atlassian.jira.plugin.PluginInjector.newInstance(PluginInjector.java:29)
at com.atlassian.jira.plugin.webfragment.JiraWebFragmentHelper.loadContextProvider(JiraWebFragmentHelper.java:51)
... 106 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.sal.api.pluginsettings.PluginSettingsFactory' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1801)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1357)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
POM
<?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.accelq.plugins.jira</groupId>
<artifactId>aq-jira-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>ACCELQ</name>
<url>http://www.accelQ.com/</url>
</organization>
<name>aq-jira-plugin</name>
<description>This plugin integrates ACCELQ into 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>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.atlassian.templaterenderer/atlassian-template-renderer-api -->
<!-- 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>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>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>5.0.0</version> <!-- adjust based on your Jira version (9.x or 10.x) -->
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>jira-maven-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>
<!-- 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.accelq.plugins.jira.*,</Export-Package>
<!-- Add package import here -->
<Import-Package>
*
</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>${atlassian.spring.scanner.version}</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>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<basedir/>
<buildDirectory/>
<mainOutputDirectory/>
<outputDirectory/>
<projectArtifact/>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.13.0</jira.version>
<amps.version>8.1.2</amps.version>
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.7</atlassian.spring.scanner.version>
<!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
<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>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
atlassian-plugin
<?xml version="1.0" encoding="UTF-8"?>
<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2" enabled="true">
<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="aq-jira-plugin"/>
<!-- add our web resources -->
<web-resource key="aq-jira-plugin-resources" name="aq-jira-plugin Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="aq-jira-plugin.css" location="/css/aq-jira-plugin.css"/>
<resource type="download" name="aq-jira-plugin.js" location="/js/aq-jira-plugin.js"/>
<resource type="download" name="images/" location="/images"/>
<context>aq-jira-plugin</context>
</web-resource>
<servlet name="Accelq Connect" i18n-name-key="accelq-connect.name" key="accelq-connect" class="com.accelq.plugins.jira.servlet.AccelqConnect">
<description key="accelq-connect.description">The Accelq Connect Plugin</description>
<url-pattern>/accelq</url-pattern>
</servlet>
<servlet name="Accelq Issue Connect" i18n-name-key="accelq-issue-connect.name" key="accelq-issue-connect" class="com.accelq.plugins.jira.servlet.AccelqIssueConnect">
<description key="accelq-issue-connect.description">The Accelq Issue Connect Plugin</description>
<url-pattern>/accelq-issue</url-pattern>
</servlet>
<web-item name="AccelQ Nav WebItem" i18n-name-key="accel-q-nav-web-item.name" key="accel-q-nav-web-item" section="system.top.navigation.bar" weight="1000">
<description key="accel-q-nav-web-item.description">The AccelQ Nav WebItem Plugin</description>
<label key="accel-q-nav-web-item.label"/>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition"/>
<link linkId="accel-q-nav-web-item-link">/plugins/servlet/accelq</link>
</web-item>
<web-item name="AccelQ plugin Configuration" i18n-name-key="accel-qplugin-configuration.name" key="accel-qplugin-configuration" section="admin_plugins_menu/aq-config" weight="1000">
<description key="accel-qplugin-configuration.description">The AccelQ plugin Configuration Plugin</description>
<label key="accel-qplugin-configuration.label"/>
<link linkId="accel-qplugin-configuration-link">/secure/AQAdminConfigAction.jspa</link>
</web-item>
<web-section name="AccelQ Configuration" i18n-name-key="accel-q-configuration.name" key="accel-q-configuration" location="admin_plugins_menu" weight="1000">
<description key="accel-q-configuration.description">The AccelQ Configuration Plugin</description>
<label key="accel-q-configuration.label"/>
</web-section>
<web-panel name="AQIssueConnect" i18n-name-key="aq-issue-connect.name" key="aq-issue-connect" location="atl.jira.view.issue.left.context" weight="1000">
<description key="aq-issue-connect.description">The AQIssueConnect Plugin</description>
<condition class="com.accelq.plugins.jira.conditions.AQTracabilityDisplayCondition"/>
<description key="aq-issue-connect.description">The AQIssueConnect Plugin</description>
<context-provider class="com.accelq.plugins.jira.providers.AQIssueConnect"/>
<resource name="view" type="velocity" location="templates/aq-issue-view/aq-issue-view.vm"/>
<label key="aq-issue-view.title"/>
</web-panel>
<webwork1 key="administration-configuration" name="Administration Configuration" i18n-name-key="administration-configuration.name">
<description key="administration-configuration.description">The Administration Configuration Plugin</description>
<actions>
<action name="com.accelq.plugins.jira.jira.webwork.AdministrationConfigurationAction" alias="AdministrationConfigurationAction">
<view name="success">/templates/aq-admin-config/aq-admin-config.vm</view>
<view name="input">/templates/aq-admin-config/aq-admin-config-edit.vm</view>
<view name="error">/templates/aq-admin-config/aq-admin-config.vm</view>
</action>
</actions>
</webwork1>
</atlassian-plugin>
AQIssueConnect
package com.accelq.plugins.jira.providers;
import com.accelq.plugins.jira.Constants;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.plugin.spring.scanner.annotation.export.ExportAsService;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.sal.api.pluginsettings.PluginSettings;
import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory;
import com.google.gson.JsonObject;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import javax.inject.Named;
@ExportAsService({AQIssueConnect.class})
@Named
public class AQIssueConnect extends AbstractJiraContextProvider {
@ComponentImport
private final PluginSettingsFactory pluginSettingsFactory;
private static final Logger log = LoggerFactory.getLogger(AQIssueConnect.class);
private List<String> errors = new ArrayList<>();
@Inject
public AQIssueConnect(PluginSettingsFactory pluginSettingsFactory) {
this.pluginSettingsFactory = pluginSettingsFactory;
}
@Override
public Map<String, Object> getContextMap(ApplicationUser applicationUser, JiraHelper jiraHelper) {
Map<String, Object> contextMap = new HashMap<>();
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
Timestamp dueDate = currentIssue.getDueDate();
this.errors.clear();
validate(contextMap, currentIssue);
contextMap.put("errors", errors);
return contextMap;
}
private JsonObject validate(Map<String, Object> context, Issue currentIssue) {
// get base url
try {
PluginSettings pluginSettings = pluginSettingsFactory.createGlobalSettings();
Object serverUrlObj = pluginSettings.get(Constants.PLUGIN_STORAGE_KEY + Constants.AQ_SRVR_KEY);
Object tenantKeyObj = pluginSettings.get(Constants.PLUGIN_STORAGE_KEY + Constants.TENANT_KEY);
Object jiraUrlObj = pluginSettings.get(Constants.PLUGIN_STORAGE_KEY + Constants.JIRAURL_KEY);
if (null == serverUrlObj || null == tenantKeyObj) {
this.errors.add(Constants.NO_PLUGIN_SETTINGS);
return null;
}
// set Url
String srvrUrl = String.valueOf(serverUrlObj);
String tenantKey = String.valueOf(tenantKeyObj);
if (srvrUrl.length() == 0) {
this.errors.add(Constants.INV_SRVR_URL);
return null;
}
if (tenantKey.length() == 0) {
this.errors.add(Constants.INV_TENANT_KEY);
return null;
}
return null;
} catch (Exception e) {
System.out.println(e.getMessage());
this.errors.add("Error in fetching data from ACCELQ server, Please contact customer support");
}
return null;
}
}