I want get jira issue info in confluence plugins.

Lion April 18, 2023

hello, I use jira and confluence together.  I write a confluence plugin with sdk, It's a servlet filter. I want to get relevant jira info (when i add a confluence link in jira issue, the confluence page will have a connected jira info) of current page. I find out  com.atlassian.confluence.plugins.metadata.jira.service.JiraMetadataService may help, so i include a maven jar below and I can find this jar in Confluence installed path.

 <dependency>
<groupId>com.atlassian.confluence.plugins</groupId>
<artifactId>confluence-jira-metadata</artifactId>
<version>4.1.9</version>
<scope>provided</scope>
</dependency>

The java code :

@ComponentImport 

private JiraMetadataService  jiraMetadataService ;

@Inject

public void setJiraMetadataService (JiraMetadataService  jiraMetadataService){

this.jiraMetadataService =jiraMetadataService ;

}
 

but When I install the plugin, It take a long time to find this service. and then timeout. the log output: 

2023-04-18 18:07:16,793 ERROR [Spring DM Context Creation Timer] [internal.dependencies.startup.DependencyWaiterApplicationContextExecutor] fail Unable to create application context for [com.zhongtai.confluence-jira-filter], unsatisfied dependencies: Dependency on [(&(objectClass=com.atlassian.confluence.plugins.metadata.jira.service.JiraMetadataService)(objectClass=com.atlassian.confluence.plugins.metadata.jira.service.JiraMetadataService))] (from bean [&jiraMetadataService])
org.springframework.context.ApplicationContextException: Application context initialization for 'com.zhongtai.confluence-jira-filter' has timed out waiting for (&(objectClass=com.atlassian.confluence.plugins.metadata.jira.service.JiraMetadataService)(objectClass=com.atlassian.confluence.plugins.metadata.jira.service.JiraMetadataService))

 

So Why Spring can not find this Service ? and How to get Jira issue info in confluence plugins? 

1 answer

0 votes
Lion April 18, 2023

I think maybe this class is a service of plugins, and it's not annotated with 

@ExportAsService, so I can not use it in other plugins ?
Dan Breyen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2023

@Lion, are you just trying to show Jira information on a Confluence page?  If so, can you get the list of issues with a JQL Query?

Like Ranjan Nanda likes this
Lion April 18, 2023

no, I just add confluence link in jira issue, so the confluence page has a connected jira info.  I want to get this jira info by pageid  in my confluence plugin. 

I can get it by jira-metadata rest api just as the confluence page does, but it's not graceful.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.2.1
TAGS
AUG Leaders

Atlassian Community Events