Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime Error when viewing comment tab plugin

Jackson Farnsworth
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.
November 12, 2018

When viewing an Issue Tab Panel added in a plugin, I get:
"Error rendering 'com.onenetwork.mergedcomments:test-panel'. Please contact your Jira administrators."

in the logs, I get:

2018-11-12 17:04:33,789 http-nio-8080-exec-14 WARN jfarnsworth 1024x29899x1 spbb9t 10.4.9.181,10.3.1.202 /browse/TST-100 [c.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'com.atlassian.util.concurrent.LazyReference$InitializationException - org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.company.mergedcomments.tabpanels.TestCustomIssueTabPanel': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.jira.issue.comments.CommentManager]: No qualifying bean of type [com.atlassian.jira.issue.comments.CommentManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.jira.issue.comments.CommentManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}'.
2018-11-12 17:04:33,790 http-nio-8080-exec-14 ERROR jfarnsworth 1024x29899x1 spbb9t 10.4.9.181,10.3.1.202 /browse/TST-100 [c.a.j.plugin.issuetabpanel.IssueTabPanelInvokerImpl] Exception thrown while trying to call showPanel() for com.company.mergedcomments:test-panel (TEST Comments Panel)
2018-11-12 17:04:33,791 http-nio-8080-exec-14 WARN jfarnsworth 1024x29899x1 spbb9t 10.4.9.181,10.3.1.202 /browse/TST-100 [c.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'com.atlassian.util.concurrent.LazyReference$InitializationException - org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.company.mergedcomments.tabpanels.TestCustomIssueTabPanel': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.jira.issue.comments.CommentManager]: No qualifying bean of type [com.atlassian.jira.issue.comments.CommentManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.jira.issue.comments.CommentManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}'.
2018-11-12 17:04:33,791 http-nio-8080-exec-14 ERROR jfarnsworth 1024x29899x1 spbb9t 10.4.9.181,10.3.1.202 /browse/TST-100 [c.a.j.plugin.issuetabpanel.IssueTabPanelInvokerImpl] Exception thrown while trying to call getActions() for com.company.mergedcomments:test-panel (TEST Comments Panel)

 

Here is the code for the class referenced in the issue-tabpanel definition in the atlassian-plugin.xml file:

package com.company.mergedcomments.tabpanels;

import com.atlassian.jira.bc.issue.comment.property.CommentPropertyService;
import com.atlassian.jira.datetime.DateTimeFormatter;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.RendererManager;
import com.atlassian.jira.issue.comments.Comment;
import com.atlassian.jira.issue.comments.CommentManager;
import com.atlassian.jira.issue.comments.CommentPermissionManager;
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager;
import com.atlassian.jira.issue.fields.renderer.comment.CommentFieldRenderer;
import com.atlassian.jira.issue.tabpanels.CommentAction;
import com.atlassian.jira.issue.tabpanels.GenericMessageAction;
import com.atlassian.jira.plugin.issuetabpanel.AbstractIssueTabPanel;
import com.atlassian.jira.plugin.issuetabpanel.IssueAction;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.template.soy.SoyTemplateRendererProvider;
import com.atlassian.jira.user.ApplicationUser;
import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;


public class TestCustomIssueTabPanel extends AbstractIssueTabPanel {

private final CommentManager commentManager;
private final FieldLayoutManager fieldLayoutManager;
private final RendererManager rendererManager;
private final DateTimeFormatter dateTimeFormatter;
private final CommentFieldRenderer commentFieldRenderer;
private final CommentPropertyService commentPropertyService;
private final JiraAuthenticationContext jiraAuthenticationContext;

public TestCustomIssueTabPanel(CommentManager commentManager, CommentPermissionManager commentPermissionManager,
IssueManager issueManager, FieldLayoutManager fieldLayoutManager,
RendererManager rendererManager, DateTimeFormatter dateTimeFormatter,
SoyTemplateRendererProvider soyTemplateRendererProvider,
CommentFieldRenderer commentFieldRenderer, CommentPropertyService commentPropertyService,
JiraAuthenticationContext jiraAuthenticationContext) {
this.commentManager = commentManager;
this.fieldLayoutManager = fieldLayoutManager;
this.rendererManager = rendererManager;
this.dateTimeFormatter = dateTimeFormatter;
this.commentFieldRenderer = commentFieldRenderer;
this.commentPropertyService = commentPropertyService;
this.jiraAuthenticationContext = jiraAuthenticationContext;
}

@Override
public List<IssueAction> getActions(Issue issue, ApplicationUser applicationUser) {

List<IssueAction> commentActions = new ArrayList<IssueAction>();

Collection<Comment> userComments = commentManager.getComments(issue);

for (final Comment comment : userComments) {
commentActions.add(new CommentAction(descriptor, comment, false, false,
false, rendererManager, fieldLayoutManager, dateTimeFormatter, commentFieldRenderer,
commentPropertyService, jiraAuthenticationContext));
}

if (commentActions.isEmpty()) {
IssueAction action = new GenericMessageAction(descriptor.getI18nBean().getText("viewissue.nocomments"));
return Lists.newArrayList(action);
}

return commentActions;
}

@Override
public boolean showPanel(Issue issue, ApplicationUser applicationUser) {
return true;
}
}

 

Any idea whats going wrong here? 

1 answer

1 accepted

0 votes
Answer accepted
Jackson Farnsworth
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.
November 13, 2018

Found the issue, since I'm moving code from an old plugin used in JIRA 6 to JIRA 7, apparently the method for creating these have changed, and the arguments are no longer passed in to the constructor. Instead, I just used ComponentAccessor to gather them together for use.

Suggest an answer

Log in or Sign up to answer