Hi,
I am trying to create a report accessing information of sprints. I am adding the greenhopper plugin in the pom.xml file:
<dependency>
<groupId>com.atlassian.jira.plugins</groupId>
<artifactId>jira-greenhopper-plugin</artifactId>
<version>${jira.greenhoper.version}</version>
<scope>provided</scope>
</dependency>
However when I try to use some classes in the constructor class:
private final RapidViewService rapidViewService;
private final VelocityChartModelFactory velocityChartModelFactory;
public BugPieReport(JiraAuthenticationContext authenticationContext, ApplicationProperties applicationProperties,
ProjectManager projectManager, SearchRequestService searchRequestService, ChartUtils chartUtils,
ChartFactory chartFactory,RapidViewService rapidViewService, VelocityChartModelFactory velocityChartModelFactory) {
super(authenticationContext, applicationProperties, projectManager, searchRequestService, chartUtils);
this.chartFactory = chartFactory;
this.jiraAuthenticationContext = authenticationContext;
this.rapidViewService = rapidViewService;
this.velocityChartModelFactory = velocityChartModelFactory;
}
I get the following error:
1 plugin failed to load during JIRA startup.
'com.atlassian.plugins.tutorial.jira.jira-report-plugin' - 'jira-report-plugin' failed to load.
Unexpected exception parsing XML document from URL [bundle://153.0:0/META-INF/spring/plugin-context.xml]; nested exception is java.lang.NullPointerException
null
It was loaded from E:\QSCPC880_EHM_Backup\Reports\Plugins\Version2\jira-report-plugin\target\jira\home\plugins\installed-plugins\jira-report-plugin-2.10-SNAPSHOT.jar
I then tried, adding the @ComponentImport in greenhopper classes:
public BugPieReport(JiraAuthenticationContext authenticationContext, ApplicationProperties applicationProperties,
ProjectManager projectManager, SearchRequestService searchRequestService, ChartUtils chartUtils,
ChartFactory chartFactory,@ComponentImport RapidViewService rapidViewService, @ComponentImport VelocityChartModelFactory velocityChartModelFactory) {
super(authenticationContext, applicationProperties, projectManager, searchRequestService, chartUtils);
this.chartFactory = chartFactory;
this.jiraAuthenticationContext = authenticationContext;
this.rapidViewService = rapidViewService;
this.velocityChartModelFactory = velocityChartModelFactory;
}
But get this error:
[c.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'org.springframework.beans.factory.UnsatisfiedDependencyException - Error creating bean with name 'com.atlassian.plugins.tutorial.jira.reports.BugPieReport': Unsatisfied dependency expressed through constructor argument with index 6 of type [com.atlassian.greenhopper.service.rapid.view.RapidViewService]: No qualifying bean of type [com.atlassian.greenhopper.service.rapid.view.RapidViewService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport(value=)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.greenhopper.service.rapid.view.RapidViewService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport(value=)}'.
What am I missing?, what is the correct way to use classes of the GreenHopper Plugin in a custom plugin?. Thanks.
Regards,
Edgar
I realized that in order to import components from other plugins i need to use also the @Scanned and @Autowired annotations, besides the @ComponentImport. I added these and could make it work:
@Scanned
public class BugPieReport extends AbstractChartReport {
private final ChartFactory chartFactory;
private final JiraAuthenticationContext jiraAuthenticationContext;
private final RapidViewService rapidViewService;
//private final VelocityChartModelFactory velocityChartModelFactory;
@Autowired
public BugPieReport(JiraAuthenticationContext authenticationContext, ApplicationProperties applicationProperties,
ProjectManager projectManager, SearchRequestService searchRequestService, ChartUtils chartUtils,
ChartFactory chartFactory, @ComponentImport RapidViewService rapidViewService/*, @ComponentImport VelocityChartModelFactory velocityChartModelFactory*/) {
super(authenticationContext, applicationProperties, projectManager, searchRequestService, chartUtils);
this.chartFactory = chartFactory;
this.jiraAuthenticationContext = authenticationContext;
this.rapidViewService = rapidViewService;
//this.velocityChartModelFactory = velocityChartModelFactory;
}
But only for the RapidViewService class. I took a look at code of GreenHopper plugin and noticed that this class is exposed in the atlassian-plugin.xml file:
<component key="greenhopper-rapidview-service" name="Rapid View Service" class="com.atlassian.greenhopper.service.rapid.view.RapidViewServiceImpl" public="true"><interface>com.atlassian.greenhopper.service.rapid.view.RapidViewService</interface></component>
But unfortunately not the VelocityChartModelFactory class. That's why I am getting this error in the log:
'com.atlassian.plugins.tutorial.jira.jira-report-plugin' - 'jira-report-plugin' failed to load.
The plugin has been disabled. A likely cause is that it timed out during initialisation
It has the following missing service dependencies :
&velocityChartModelFactory of type (&(objectClass=com.atlassian.greenhopper.web.rapid.chart.VelocityChartModelFactory)(objectClass=com.atlassian.greenhopper.web.rapid.chart.VelocityChartModelFactory))
So I am looking how to include that class. I see that only the javascript controllers are exposed for that class in the atlassian-plugin.xml file.
If someone has a clue how to avoid the above error, would be appreciated.
Regards,
Edgar
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.