Facing issue with custom clone plugin, extends com.atlassian.jira.web.action.issue.CloneIssueDetails

Below is my java class, same code works in JIRA 6.4.12 version, facing issue with JIRA7.2.7 version, getting org.springframework.beans.factory.NoSuchBeanDefinitionException for TaskDescriptorBean.Factory.class . I have tried even Component-import from xml facing same issue

public class CloneIssueDetails extends com.atlassian.jira.web.action.issue.CloneIssueDetails {

private static final long serialVersionUID = 7280519307582514363L;

//ComponentAccessor.getComponent(com.atlassian.jira.web.bean.TaskDescriptorBean.Factory.class)

@Inject
public CloneIssueDetails(@ComponentImport final ApplicationProperties applicationProperties,@ComponentImport final PermissionManager permissionManager,
		@ComponentImport final IssueLinkManager issueLinkManager,@ComponentImport final IssueLinkTypeManager issueLinkTypeManager,@ComponentImport final SubTaskManager subTaskManager,
		@ComponentImport final AttachmentManager attachmentManager,@ComponentImport final FieldManager fieldManager,
		@ComponentImport final IssueCreationHelperBean issueCreationHelperBean,@ComponentImport final IssueFactory issueFactory,@ComponentImport final IssueService issueService,
		@ComponentImport final TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator,@ComponentImport final TaskManager taskManager,
		@ComponentImport final JiraAuthenticationContext jiraAuthenticationContext, @ComponentImport final DateTimeFormatterFactory dateTimeFormatterFactory) {
	
	super(applicationProperties, permissionManager, issueLinkManager, issueLinkTypeManager, subTaskManager,
			attachmentManager, fieldManager, issueCreationHelperBean, issueFactory, issueService,
			temporaryAttachmentsMonitorLocator, taskManager,ComponentAccessor.getComponent(com.atlassian.jira.web.bean.TaskDescriptorBean.Factory.class));
	// TODO Auto-generated constructor stub
}

}

Error Logs :slight_smile:


2017-03-27 14:11:44,204 http-bio-8443-exec-1025 ERROR kiranped 851x276734x1 1pgp57u 106.66.139.56,192.68.228.90 /secure/CloneIssueDetails!default.jspa [c.a.j.config.webwork.JiraActionFactory] Error autowiring Action ‘com.go2group.jira.plugin.common.action.CloneIssueDetails’.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.go2group.jira.plugin.common.action.CloneIssueDetails’: Unsatisfied dependency expressed through constructor argument with index 13 of type [com.atlassian.jira.web.bean.TaskDescriptorBean$Factory]: : No qualifying bean of type [com.atlassian.jira.web.bean.TaskDescriptorBean$Factory] 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.web.bean.TaskDescriptorBean$Factory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1139)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:342)

 2 filtered

Looking at the ContainerRegistrar it looks like that’s marked as Internal. Can you use the TaskManager and submit the request that way in your code?

Same issue with the below code as well.

public CloneIssueDetails(ApplicationProperties applicationProperties, PermissionManager permissionManager, 
		IssueLinkManager issueLinkManager, IssueLinkTypeManager issueLinkTypeManager, SubTaskManager subTaskManager, AttachmentManager attachmentManager, FieldManager fieldManager, 
		IssueCreationHelperBean issueCreationHelperBean, IssueFactory issueFactory, IssueService issueService, 
		TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator, ProjectFactory projectFactory, TaskManager taskManager,TaskDescriptorBean.Factory taskBeanFactory)
  {super(applicationProperties, permissionManager, issueLinkManager, issueLinkTypeManager, subTaskManager, attachmentManager, fieldManager, issueCreationHelperBean, issueFactory, issueService, temporaryAttachmentsMonitorLocator, taskManager, taskBeanFactory);

	}

sorry i didn’t get you, TaskManager? i am getting error at TaskDescriptorBean.Factory
can you please be more specific.

I am breaking my head on this, I tried most of the approaches getting same error. can anyone help me on this

I believe I had similar issue and adding @Scanned to the class fixed the issue. Not sure if that’s the solution for your problem but could you give it a try?

I tried Scanned as well, getting same error.

// @Scanned

tried ComponentImport in different ways, but no luck.

/*@ComponentImport
private final TaskDescriptorBean.Factory taskBeanFactory; */

// private final Factory taskBeanFactory2 = ComponentAccessor.getComponent(com.atlassian.jira.web.bean.TaskDescriptorBean.Factory.class);

// DateTimeFormatterFactory dateTimeFormatterFactory2 = ComponentAccessor.getComponent(DateTimeFormatterFactory.class);
// JiraAuthenticationContext jiraAuthenticationContext2 = ComponentAccessor.getComponent(JiraAuthenticationContext.class);

// static TaskDescriptorBean.Factory taskBeanFactory2 = ComponentAccessor.getOSGiComponentInstanceOfType(com.atlassian.jira.web.bean.TaskDescriptorBean.Factory.class)
// static TaskDescriptorBean.Factory taskBeanFactory2 = ComponentAccessor.getComponent(com.atlassian.jira.web.bean.TaskDescriptorBean.Factory.class); // getComponent(Factory.class);
//Factory taskBeanFactory = new Factory( JiraAuthenticationContext jiraAuthenticationContext, DateTimeFormatterFactory dateTimeFormatterFactory)
/*
*getOSGiComponentInstanceOfType(com.atlassian.jira.web.bean.TaskDescriptorBean.Factory.class);
*
static JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getJiraAuthenticationContext();
static DateTimeFormatterFactory dateTimeFormatterFactory;
static TaskDescriptorBean.Factory taskBeanFactory = new Factory( jiraAuthenticationContext , DateTimeFormatter );
*/

Hi Daniel,
Thanks for the reply.
can you please be more specific ( “Can you use the TaskManager and submit the request that way in your code?”)

hi kiran,
have you solved this issue?

Hi, we solved this issue using this constructor, it works!

@Autowired
	public CloneSubtaskCheckAction(ApplicationProperties applicationProperties, PermissionManager permissionManager,
			IssueLinkManager issueLinkManager, IssueLinkTypeManager issueLinkTypeManager, SubTaskManager subTaskManager,
			AttachmentManager attachmentManager, FieldManager fieldManager,
			IssueCreationHelperBean issueCreationHelperBean, IssueFactory issueFactory, IssueService issueService,
			TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator,  TaskManager taskManager, JiraAuthenticationContext ctx, DateTimeFormatterFactory dateTimeFormatterFactory) {
		
		super(applicationProperties, permissionManager, issueLinkManager, issueLinkTypeManager, subTaskManager,
				attachmentManager, fieldManager, issueCreationHelperBean, issueFactory, issueService,
				temporaryAttachmentsMonitorLocator, taskManager, new  TaskDescriptorBean.Factory (ctx,dateTimeFormatterFactory));
		
	}
1 Like

works for me, too - Thanks