How do i component-import 'com.atlassian.jira.web.bean.TaskDescriptorBean.Factory' into my class (JIRA 7.2.7 Plugin)

I am writing a custom clone plugin for which i am extending **com.atlassian.jira.web.action.issue.CloneIssueDetails** class.
for which i need to supply following components to super constructor

ApplicationProperties applicationProperties, PermissionManager permissionManager,
			IssueLinkManager issueLinkManager, IssueLinkTypeManager issueLinkTypeManager, SubTaskManager subTaskManager,
			AttachmentManager attachmentManager, FieldManager fieldManager,
			IssueCreationHelperBean issueCreationHelperBean, IssueFactory issueFactory, IssueService issueService,
			TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator, TaskManager taskManager,
			Factory taskBeanFactory

I am able to get all the components except com.atlassian.jira.web.bean.TaskDescriptorBean.Factory taskBeanFactory. i am getting below exception :

2017-04-25 09:45:43,319 http-bio-8443-exec-917 ERROR kiranped 585x318714x1 16af4in 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails!default.jspa [c.a.j.config.webwork.JiraActionFactory] Error autowiring Action 'com.local.jira.plugin.common.action.CloneIssueDetails'.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.local.jira.plugin.common.action.CloneIssueDetails': Unsatisfied dependency expressed through constructor argument with index 15 of type [com.atlassian.jira.util.ComponentLocator]: : No qualifying bean of type [com.atlassian.jira.util.ComponentLocator] 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.util.ComponentLocator] 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
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor.createBean(DefaultSpringContainerAccessor.java:97)
	at com.atlassian.jira.config.webwork.JiraActionFactory$JiraPluginActionFactory.getActionImpl(JiraActionFactory.java:389)
	at webwork.action.factory.PrefixActionFactoryProxy.getActionImpl(PrefixActionFactoryProxy.java:99)
	at webwork.action.factory.JspActionFactoryProxy.getActionImpl(JspActionFactoryProxy.java:59)
	at webwork.action.factory.CommandActionFactoryProxy.getActionImpl(CommandActionFactoryProxy.java:60)
	at com.atlassian.jira.config.webwork.LookupAliasActionFactoryProxy.getActionImpl(LookupAliasActionFactoryProxy.java:61)
	at webwork.action.factory.CommandActionFactoryProxy.getActionImpl(CommandActionFactoryProxy.java:51)
	at webwork.action.factory.ContextActionFactoryProxy.getActionImpl(ContextActionFactoryProxy.java:36)
	at webwork.action.factory.PrepareActionFactoryProxy.getActionImpl(PrepareActionFactoryProxy.java:37)
	at com.atlassian.jira.config.webwork.JiraActionFactory$SafeParameterSettingActionFactoryProxy.getActionImpl(JiraActionFactory.java:147)
	at webwork.action.factory.ChainingActionFactoryProxy.getActionImpl(ChainingActionFactoryProxy.java:53)
	at com.atlassian.jira.config.webwork.JiraActionFactory.getActionImpl(JiraActionFactory.java:301)
	... 2 filtered
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	... 52 filtered
	at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:62)
	... 7 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 51 filtered
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterChainWithProfiling(FieldSecurityFilter.java:251)
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterInterval(FieldSecurityFilter.java:160)
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilter(FieldSecurityFilter.java:63)
	... 10 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:76)
	... 1 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:74)
	... 36 filtered
	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
	... 10 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 4 filtered
	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
	... 29 filtered
	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
	... 26 filtered
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.jira.util.ComponentLocator] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
2017-04-25 09:45:43,327 http-bio-8443-exec-917 ERROR kiranped 585x318714x1 16af4in 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails!default.jspa [c.a.j.web.dispatcher.JiraWebworkActionDispatcher] Exception thrown from action 'CloneIssueDetails!default', returning 404 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.local.jira.plugin.common.action.CloneIssueDetails': Unsatisfied dependency expressed through constructor argument with index 15 of type [com.atlassian.jira.util.ComponentLocator]: : No qualifying bean of type [com.atlassian.jira.util.ComponentLocator] 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.util.ComponentLocator] 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
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor.createBean(DefaultSpringContainerAccessor.java:97)
	at com.atlassian.jira.config.webwork.JiraActionFactory$JiraPluginActionFactory.getActionImpl(JiraActionFactory.java:389)
	at webwork.action.factory.PrefixActionFactoryProxy.getActionImpl(PrefixActionFactoryProxy.java:99)
	at webwork.action.factory.JspActionFactoryProxy.getActionImpl(JspActionFactoryProxy.java:59)
	at webwork.action.factory.CommandActionFactoryProxy.getActionImpl(CommandActionFactoryProxy.java:60)
	at com.atlassian.jira.config.webwork.LookupAliasActionFactoryProxy.getActionImpl(LookupAliasActionFactoryProxy.java:61)
	at webwork.action.factory.CommandActionFactoryProxy.getActionImpl(CommandActionFactoryProxy.java:51)
	at webwork.action.factory.ContextActionFactoryProxy.getActionImpl(ContextActionFactoryProxy.java:36)
	at webwork.action.factory.PrepareActionFactoryProxy.getActionImpl(PrepareActionFactoryProxy.java:37)
	at com.atlassian.jira.config.webwork.JiraActionFactory$SafeParameterSettingActionFactoryProxy.getActionImpl(JiraActionFactory.java:147)
	at webwork.action.factory.ChainingActionFactoryProxy.getActionImpl(ChainingActionFactoryProxy.java:53)
	at com.atlassian.jira.config.webwork.JiraActionFactory.getActionImpl(JiraActionFactory.java:301)
	... 2 filtered
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	... 52 filtered
	at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:62)
	... 7 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 51 filtered
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterChainWithProfiling(FieldSecurityFilter.java:251)
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterInterval(FieldSecurityFilter.java:160)
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilter(FieldSecurityFilter.java:63)
	... 10 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:76)
	... 1 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:74)
	... 36 filtered
	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
	... 10 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 4 filtered
	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
	... 29 filtered
	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
	... 26 filtered
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.jira.util.ComponentLocator] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
2017-04-25 09:45:43,333 http-bio-8443-exec-917 DEBUG kiranped 585x318714x1 16af4in 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails!default.jspa [c.a.util.profiling.UtilTimerStack] [691ms] - /secure/CloneIssueDetails!default.jspa
    
2017-04-25 09:45:43,333 http-bio-8443-exec-917 DEBUG kiranped 585x318714x1 16af4in 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails!default.jspa [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/691ms : 0.0% 
2017-04-25 09:45:46,123 Caesium-1-3 DEBUG ServiceRunner     [c.a.util.profiling.UtilTimerStack] [1ms] - DefaultJqlOperandResolver.getValues() - multivalue
      [1ms] - MultiValueOperandHandler.getValues()

I have tried below approaches :
First:

    <component key="taskBeanFactory" name="TaskBeanFactory" class="com.atlassian.jira.web.bean.TaskDescriptorBean.Factory"></component>   -->
	<component key="componentLocator" name="Component Locator" class="com.atlassian.jira.util.JiraComponentLocator">
		<interface>com.atlassian.jira.util.ComponentLocator</interface>
	</component>

Second:

	<component-import key="DateTimeFormatterFactory" interface="com.atlassian.jira.datetime.DateTimeFormatterFactory"/>
    <component-import key="JiraAuthenticationContext" interface="com.atlassian.jira.security.JiraAuthenticationContext"/>
 passing object to super constructor  : new Factory( jiraAuthenticationContext ,  DateTimeFormatter ).

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

Below JIRA 7 version the plugin was working but it’s not working in JIRA7.x + version. i am breaking my head on this. Please help me

Hi Kiran,
So a couple of things changed with JIRA 6->JIRA 7: https://developer.atlassian.com/jiradev/latest-updates/preparing-for-jira-7-0/jira-7-0-platform-changes . One of the side effects these is that it becomes much more stricter about private/public services (I’m guessing that’s the root cause).

I think your second approach should work from looking at the javadoc: https://docs.atlassian.com/jira/7.1.7/com/atlassian/jira/web/bean/TaskDescriptorBean.Factory.html . Looking at the source of it - it doesn’t really do anything magical so, it should just be a pass through. When you do it that way - what’s the error you’re getting?

Hi Daniel,

I used ComponentAccessor insted Component-import. Now it’s working in my Local JIRA instance but when I install the same plugin got same error. I don’t understand why?
Can i contact is there any issue with my Developer instance. because this plugin worked in Dev/QA instance before we upgraded to JIRA 7.2.7 from 6.4.12.

More info : when i execute testcase, getting clone-pop-up and wen i click create it will process for a sec and getting 404 error with URL : https://jira-dev.efi.com/issue/CloneIssueProgress.jspa?taskId=21404

ERROR :

2017-04-25 10:29:20,682 http-bio-8443-exec-949 ERROR kiranped 629x319537x1 hm6nh9 103.36.149.7,192.68.228.90 /issue/CloneIssueProgress.jspa [c.a.j.config.webwork.JiraActionFactory] Error autowiring Action 'com.atlassian.jira.web.action.issue.CloneIssueDetails'.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.jira.web.action.issue.CloneIssueDetails': Unsatisfied dependency expressed through constructor argument with index 12 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
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor.createBean(DefaultSpringContainerAccessor.java:97)
	at com.atlassian.jira.config.webwork.JiraActionFactory$JiraPluginActionFactory.getActionImpl(JiraActionFactory.java:389)
	at webwork.action.factory.PrefixActionFactoryProxy.getActionImpl(PrefixActionFactoryProxy.java:82)
	at webwork.action.factory.JspActionFactoryProxy.getActionImpl(JspActionFactoryProxy.java:59)
	at webwork.action.factory.CommandActionFactoryProxy.getActionImpl(CommandActionFactoryProxy.java:51)
	at com.atlassian.jira.config.webwork.LookupAliasActionFactoryProxy.getActionImpl(LookupAliasActionFactoryProxy.java:61)
	at webwork.action.factory.CommandActionFactoryProxy.getActionImpl(CommandActionFactoryProxy.java:60)
	at webwork.action.factory.ContextActionFactoryProxy.getActionImpl(ContextActionFactoryProxy.java:36)
	at webwork.action.factory.PrepareActionFactoryProxy.getActionImpl(PrepareActionFactoryProxy.java:37)
	at com.atlassian.jira.config.webwork.JiraActionFactory$SafeParameterSettingActionFactoryProxy.getActionImpl(JiraActionFactory.java:147)
	at webwork.action.factory.ChainingActionFactoryProxy.getActionImpl(ChainingActionFactoryProxy.java:53)
	at com.atlassian.jira.config.webwork.JiraActionFactory.getActionImpl(JiraActionFactory.java:301)
	... 2 filtered
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	... 56 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 46 filtered
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterChainWithProfiling(FieldSecurityFilter.java:251)
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilterInterval(FieldSecurityFilter.java:160)
	at com.quisapps.jira.fieldsecurity.filter.FieldSecurityFilter.doFilter(FieldSecurityFilter.java:63)
	... 10 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:76)
	... 1 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:74)
	... 36 filtered
	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
	... 10 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 4 filtered
	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
	... 29 filtered
	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
	... 26 filtered
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: 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.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
2017-04-25 10:29:20,788 Caesium-1-1 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:20,795 Caesium-1-1 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:20,882 http-bio-8443-exec-949 DEBUG kiranped 629x319537x1 hm6nh9 103.36.149.7,192.68.228.90 /issue/CloneIssueProgress.jspa [c.a.util.profiling.UtilTimerStack] [265ms] - /issue/CloneIssueProgress.jspa
    
2017-04-25 10:29:20,882 http-bio-8443-exec-949 DEBUG kiranped 629x319537x1 hm6nh9 103.36.149.7,192.68.228.90 /issue/CloneIssueProgress.jspa [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/265ms : 0.0% 
2017-04-25 10:29:20,935 Caesium-1-4 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,108 Caesium-1-2 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,122 JiraTaskExectionThread-5 ERROR kiranped 629x319536x1 hm6nh9 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails.jspa [CRM-PLUGIN] Could not find the custom field '***default***'
2017-04-25 10:29:21,175 Caesium-1-4 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,178 Caesium-1-1 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/3ms : 0.0% 
2017-04-25 10:29:21,200 Caesium-1-2 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,359 Caesium-1-1 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/2ms : 0.0% 
2017-04-25 10:29:21,369 Caesium-1-4 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/5ms : 0.0% 
2017-04-25 10:29:21,403 Caesium-1-2 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,451 Caesium-1-4 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,453 Caesium-1-1 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,819 Caesium-1-2 DEBUG ServiceRunner     [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 0 keys (0 unique) took 0ms/0ms : NaN% 
2017-04-25 10:29:21,826 JiraTaskExectionThread-5 DEBUG kiranped 629x319536x1 hm6nh9 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails.jspa [c.a.j.web.filters.ThreadLocalQueryProfiler] RESULT GROUP: OfBizDelegator
2017-04-25 10:29:21,826 JiraTaskExectionThread-5 DEBUG kiranped 629x319536x1 hm6nh9 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails.jspa [c.a.j.web.filters.ThreadLocalQueryProfiler]   18:8ms findByPrimaryKey [0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,1,1]
2017-04-25 10:29:21,826 JiraTaskExectionThread-5 DEBUG kiranped 629x319536x1 hm6nh9 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails.jspa [c.a.j.web.filters.ThreadLocalQueryProfiler] OfBizDelegator: 18 keys (1 unique) took 8ms/1619ms : 0.4941322% 8ms/query avg.
2017-04-25 10:29:21,826 JiraTaskExectionThread-5 DEBUG kiranped 629x319536x1 hm6nh9 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails.jspa [c.a.j.web.filters.ThreadLocalQueryProfiler] 
2017-04-25 10:29:21,826 JiraTaskExectionThread-5 DEBUG kiranped 629x319536x1 hm6nh9 103.36.149.7,192.68.228.90 /secure/CloneIssueDetails.jspa [c.a.j.web.filters.ThreadLocalQueryProfiler] PROFILED : 18 keys (1 unique) took 8ms/1619ms : 0.4941322% 0ms/query avg.

i did approach Atlassian Support but they directed me to Developer community stating they won’t support. What should i do? plz advice

Well there might be a couple of reasons that things might be happening that way. First thing - don’t use ComponentAccessor - it really should be the last ditch thing to use (it should be seen as an anti-pattern when you do have to use it) - you can get all kinds of “interesting” effects with the osgi system.

Could you paste in your code in here ? (Feel free to remove the parts that does stuff - mostly interested in your constructor, class declaration and private instance variables. I can piece things together based on what you have above but having the real thing would be good? Also does your pom.xml have any reference to atlassian-scanner ?

CloneIssueDetails class

package com.local.jira.plugin.common.action;

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

import javax.inject.Named;

import org.apache.log4j.Logger;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.config.SubTaskManager;
import com.atlassian.jira.config.properties.ApplicationProperties;
import com.atlassian.jira.datetime.DateTimeFormatterFactory;
import com.atlassian.jira.issue.AttachmentManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueFactory;
import com.atlassian.jira.issue.TemporaryAttachmentsMonitorLocator;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.fields.FieldManager;
import com.atlassian.jira.issue.link.IssueLinkManager;
import com.atlassian.jira.issue.link.IssueLinkTypeManager;
import com.atlassian.jira.project.ProjectFactory;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.security.PermissionManager;
import com.atlassian.jira.task.TaskManager;
import com.atlassian.jira.web.action.issue.IssueCreationHelperBean;
import com.atlassian.jira.web.bean.TaskDescriptorBean;
import com.atlassian.jira.web.bean.TaskDescriptorBean.Factory;
//import com.atlassian.jira.web.bean.TaskDescriptorBean.Factory;
import com.local.jira.plugin.common.util.PropertyReader;
import com.atlassian.jira.util.ComponentLocator;

// @Scanned
//@ExportAsService
//@Component
//@Named ("CloneIssueDetails")
public class CloneIssueDetails extends com.atlassian.jira.web.action.issue.CloneIssueDetails{
	
	private static final long serialVersionUID = 7280519307582514363L;

	//private static final TaskDescriptorBean.Factory taskBeanFactory3; 
	
	private static Logger log = Logger.getLogger(CloneIssueDetails.class);

	private static Factory fc = (TaskDescriptorBean.Factory) ComponentAccessor.getOSGiComponentInstanceOfType(com.atlassian.jira.web.bean.TaskDescriptorBean.Factory.class);

	private static ApplicationProperties applicationProperties = ComponentAccessor.getApplicationProperties();

	private static PermissionManager permissionManager = ComponentAccessor.getPermissionManager();
	
	private static IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();

	private static IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager.class);

	private static SubTaskManager subTaskManager = ComponentAccessor.getSubTaskManager();

	private static AttachmentManager attachmentManager = ComponentAccessor.getAttachmentManager();

	private static FieldManager fieldManager = ComponentAccessor.getFieldManager();

	private static IssueFactory issueFactory = ComponentAccessor.getIssueFactory();
	
	private static IssueCreationHelperBean issueCreationHelperBean = ComponentAccessor.getComponent(IssueCreationHelperBean.class);
	
	private static TaskManager taskManager = ComponentAccessor.getComponent(TaskManager.class);
	
	private static IssueService issueService = ComponentAccessor.getIssueService();
	
	private static TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator = ComponentAccessor.getComponent(TemporaryAttachmentsMonitorLocator.class);

private final PropertyReader config;
		
	public CloneIssueDetails() throws InterruptedException
	  {		
		super(applicationProperties, permissionManager, issueLinkManager, issueLinkTypeManager, subTaskManager, attachmentManager, fieldManager, issueCreationHelperBean, issueFactory, issueService, temporaryAttachmentsMonitorLocator, taskManager,fc );
		config = PropertyReader.getInstance();
		
		// CloneIssueDetails.class.wait(1000);
	}
	

	@Override
	public List<CustomField> getCustomFields(Issue issue) {
		List<CustomField> originalCFList = super.getCustomFields(issue);
		
		List<CustomField> excludeList = getExcludedCustomfields();
		
		List<CustomField> filteredCFList = new ArrayList<CustomField>();
		
		for (CustomField cf : originalCFList){
			if (!excludeList.contains(cf)){
				filteredCFList.add(cf);
			}else{
				log.debug("Customfield ignored from clone : "+cf.getName());
				
			}
		}
		
		return filteredCFList;
	}
	
	private List<CustomField> getExcludedCustomfields(){
		String cfNames = config.getPropertyValue("native.clone.exclusion.customfields");
		
		log.debug("Configured exclusion list - "+cfNames);
		
		if (cfNames != null && !cfNames.equals("native.clone.exclusion.customfields")){
			String[] cfNameArr = cfNames.split(",");
			
			List<CustomField> cfList = new ArrayList<CustomField>();
			
			for (String cfName : cfNameArr){
				CustomField cf = null;
				Collection<CustomField> customfields = getCustomFieldManager().getCustomFieldObjectsByName(cfName.trim());
				
				if (customfields != null && customfields.size() > 0){
					cf = customfields.iterator().next();
				}
				
				if (cf != null){
					cfList.add(cf);	
				}
			}
			
			return cfList;
			
		}else{
			return Collections.emptyList();
		}
	}
}
PluginConstants class
package com.local.jira.plugin.common.action.api;

public class PluginConstants {
	public static final String PROPERTY_FILE = "synch-plugin.properties";
}

PropertyReader class

package com.local.jira.plugin.common.action.api;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

import org.apache.log4j.Logger;

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.config.util.JiraHome;
import com.local.jira.plugin.common.action.api.PluginConstants;
import com.local.jira.plugin.common.action.api.PropertyReader;

public class PropertyReader {
private static PropertyReader instance;
	
	private static Logger log = Logger.getLogger(PropertyReader.class);
	
	private final Properties config;
	
	private PropertyReader() {
		config = loadConfig();
	}
	
	private Properties loadConfig(){
		JiraHome jirahome = ComponentAccessor.getComponentOfType(JiraHome.class);
		String homeDir = jirahome.getHomePath();
	
		Properties config = new Properties();
		try{
			config.load(new FileReader(homeDir+File.separator+PluginConstants.PROPERTY_FILE));	
		}catch(IOException ex){
			log.error("Error loading file "+PluginConstants.PROPERTY_FILE,ex);
		}
		
		return config;
	}
	
	//Worth loading every day when this runs, which helps reloading the property without restarting the application when rule changes
	public static PropertyReader getInstance(){
		if (instance == null){
			instance = new PropertyReader();
		}
		return instance;
	}
	
	public String getPropertyValue(String key){
		return config.getProperty(key, key);
	}
	
	public Set<String> getKeySet(){
		return config.stringPropertyNames();
	}
}

XML file

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
    <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="common-synch-clone"/>
    
    <!-- add our web resources -->
    <web-resource key="common-synch-clone-resources" name="common-synch-clone Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
        
        <resource type="download" name="common-synch-clone.css" location="/css/common-synch-clone.css"/>
        <resource type="download" name="common-synch-clone.js" location="/js/common-synch-clone.js"/>
        <resource type="download" name="images/" location="/images"/>

        <context>common-synch-clone</context>
    </web-resource>
    
    
    <web-item key="clone-issue" i18n-name-key="webfragments.view.issue.opsbar.operations.ops.clone" name="Clone this issue(EFI)" section="operations-operations" weight="20">
        <label key="Clone For FIT Only"/>
        <styleClass>issueaction-clone-issue</styleClass>
        <link linkId="clone-issue">
            /secure/CloneIssueDetails!default.jspa?id=${issueId}
        </link>
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.HasProjectPermissionCondition">
            <param name="permission">create</param>
        </condition>
    </web-item>
	
    <webwork1 key="efi_nativeclone_action" name="Native Clone Action" class="java.lang.Object">
      <actions>
        <action name="com.local.jira.plugin.common.action.CloneIssueDetails" alias="CloneIssueDetails">
        <view name="input">/secure/views/cloneissue-start.jsp</view>
        <view name="error">/secure/views/cloneissue-start.jsp</view>
    	</action>
	  </actions>
	</webwork1>

	<component-import key="DateTimeFormatterFactory" interface="com.atlassian.jira.datetime.DateTimeFormatterFactory"/>
    <component-import key="JiraAuthenticationContext" interface="com.atlassian.jira.security.JiraAuthenticationContext"/>
	<component-import key="FieldManager" interface="com.atlassian.jira.issue.fields.FieldManager"/>
    <component-import key="IssueFactory" interface="com.atlassian.jira.issue.IssueFactory"/>
    <component-import key="ApplicationProperties" interface="com.atlassian.jira.config.properties.ApplicationProperties"/>
	<component-import key="TemporaryAttachmentsMonitorLocator" interface="com.atlassian.jira.issue.TemporaryAttachmentsMonitorLocator"/>
	<component-import key="ProjectFactory" interface="com.atlassian.jira.project.ProjectFactory"/>
	<component-import key="IssueLinkTypeManager" interface="com.atlassian.jira.issue.link.IssueLinkTypeManager"/>
    <component-import key="TaskManager" interface="com.atlassian.jira.task.TaskManager"/>
    <component-import key="PermissionManager" interface="com.atlassian.jira.security.PermissionManager"/>
    <component-import key="SubTaskManager" interface="com.atlassian.jira.config.SubTaskManager"/>
    <component-import key="AttachmentManager" interface="com.atlassian.jira.issue.AttachmentManager"/>
    <component-import key="IssueLinkManager" interface="com.atlassian.jira.issue.link.IssueLinkManager"/>
    <component-import key="IssueService" interface="com.atlassian.jira.bc.issue.IssueService"/>
        <component-import key="FieldManager" interface="com.atlassian.jira.issue.fields.FieldManager"/>
    <component-import key="IssueFactory" interface="com.atlassian.jira.issue.IssueFactory"/>
    <component-import key="ApplicationProperties" interface="com.atlassian.jira.config.properties.ApplicationProperties"/>
	<component-import key="TemporaryAttachmentsMonitorLocator" interface="com.atlassian.jira.issue.TemporaryAttachmentsMonitorLocator"/>
	<component-import key="ProjectFactory" interface="com.atlassian.jira.project.ProjectFactory"/>
	<component-import key="IssueLinkTypeManager" interface="com.atlassian.jira.issue.link.IssueLinkTypeManager"/>
    <component-import key="TaskManager" interface="com.atlassian.jira.task.TaskManager"/>
    <component-import key="PermissionManager" interface="com.atlassian.jira.security.PermissionManager"/>
    <component-import key="SubTaskManager" interface="com.atlassian.jira.config.SubTaskManager"/>
    <component-import key="AttachmentManager" interface="com.atlassian.jira.issue.AttachmentManager"/>
    <component-import key="IssueLinkManager" interface="com.atlassian.jira.issue.link.IssueLinkManager"/>
    <component-import key="IssueService" interface="com.atlassian.jira.bc.issue.IssueService"/>

<!--    <component key="taskBeanFactory" name="TaskBeanFactory" class="com.atlassian.jira.web.bean.TaskDescriptorBean.Factory"></component>   -->
	<component key="componentLocator" name="Component Locator" class="com.atlassian.jira.util.JiraComponentLocator">
		<interface>com.atlassian.jira.util.ComponentLocator</interface>
	</component>
</atlassian-plugin>

POM file

<?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.local.jira.plugin</groupId>
    <artifactId>synch-common-plugin</artifactId>
    <version>2.0.5</version>
 
    <parent>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-plugins</artifactId>
        <version>7.2.7</version>
    </parent> 

    <organization>
        <name>local</name>
        <url>http://www.local.com/</url>
    </organization>

    <name>EFI-Local Common Synch Plugin</name>
    <description>Jira common synch plugin for EFI</description>
    <packaging>bundle</packaging>

    <dependencies>
	    <dependency>
	      <groupId>com.atlassian.jira</groupId>
	      <artifactId>jira-api</artifactId>
	      <version>${jira.version}</version>
	      <scope>provided</scope>
	    </dependency>
		<dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <version>2.7.2</version>
            <scope>provided</scope>
        </dependency>
		<dependency>
		    <groupId>com.atlassian.jira</groupId>
		    <artifactId>jira-rest-api</artifactId>
		    <version>${jira.version}</version>
		    <scope>provided</scope>
		</dependency>
		 <dependency>
		    <groupId>com.atlassian.jira</groupId>
		    <artifactId>jira-rest-plugin</artifactId>
		    <version>${jira.version}</version>
		    <scope>provided</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>runtime</scope>
        </dependency>     	-->
        
        
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>provided</scope>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <scope>provided</scope>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>3.8</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.data.version}</productDataVersion>
                </configuration>
            </plugin> -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration> 
            </plugin>
              <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                  <executions>
                    <execution>
                      <id>create-bundle</id>
                      <phase>package</phase>
                      <goals>
                        <goal>bundle</goal>
                      </goals>
                    </execution>
                  </executions>
                  <configuration>
                    <instructions>
                      <Import-Package>
                          javax.xml.bind*;version="2.1.0",
                          com.atlassian.jira.rest,
                          *
                      </Import-Package>
                      <Export-Package>
                         com.local.jira.plugin.common.rest.*;version="${project.version}",
                      </Export-Package>
                      <DynamicImport-Package>org.springframework.*,org.aopalliance.*</DynamicImport-Package>
                      <Embed-Dependency>*;scope=compile;inline=false</Embed-Dependency>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
       <jira.version>7.2.7</jira.version>
	   <jira.data.version>7.2.7</jira.data.version>
	<!--   <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>   -->
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    
    <repositories>
        <repository>
            <id>maven repository</id>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>
</project>

Using below command overriding default maven version

export ATLAS_MVN=/Users/kiranped-mbp/Downloads/apache-maven-3.3.9/bin/mvn

Constructor using component-import in XML

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

		config = PropertyReader.getInstance();
	}

please let me know if u need more details

Sorry for the late response (I was heads down in some stuff).

So a couple of things that’s probably causing the headaches:

  1. You’re not using amps plugins. They do a lot of magical stuff. So unless
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>

does something special for you - you might want to switch back to the atlassian-sdk amps plugin.

  1. Stop using the ComponentAccessor. Do something like:
public class CloneIssueDetails extends com.atlassian.jira.web.action.issue.CloneIssueDetails{
	
	private final final long serialVersionUID = 7280519307582514363L;

	
	private final Logger log = Logger.getLogger(CloneIssueDetails.class);

	private final ApplicationProperties applicationProperties;

	private final PermissionManager permissionManager;
	
	private final IssueLinkManager issueLinkManager;

	private final IssueLinkTypeManager issueLinkTypeManager;

	private final SubTaskManager subTaskManager;

	private final AttachmentManager attachmentManager;

	private final FieldManager fieldManager;

	private final IssueFactory issueFactory;
	
	private final IssueCreationHelperBean issueCreationHelperBean;
	
	private final TaskManager taskManager;
	
	private final IssueService issueService;
	
	private final TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator;

private final PropertyReader config;
		
	public CloneIssueDetails(

 final ApplicationProperties applicationProperties,
 final PermissionManager permissionManager,
 final IssueLinkManager issueLinkManager,
 final IssueLinkTypeManager issueLinkTypeManager,
 final SubTaskManager subTaskManager,
 final AttachmentManager attachmentManager,
 final FieldManager fieldManager,
 final IssueFactory issueFactory,
 final IssueCreationHelperBean issueCreationHelperBean,
final TaskManager taskManager,
final IssueService issueService,	
final TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator
)
	  {		
this.issueService = issueService;
// repeat for all others 
// create the TaskFactory here... That way it won't be stale.
		super(applicationProperties, permissionManager, issueLinkManager, issueLinkTypeManager, subTaskManager, attachmentManager, fieldManager, issueCreationHelperBean, issueFactory, issueService, temporaryAttachmentsMonitorLocator, taskManager,fc );
		config = PropertyReader.getInstance();
		
		// CloneIssueDetails.class.wait(1000);
	}

Instatiation the way you’ve got it will cause issue when your addon is re-registered when other add-ons are enabled in osgi land.

Hi daniel,
thanks for the reply.

Pont 1: i even tried with amps but no luck

<?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.local.jira.plugin.common.action</groupId>
    <artifactId>common-synch-clone</artifactId>
    <version>2.0</version>

    <organization>
        <name>Example Company</name>
        <url>http://www.example.com/</url>
    </organization>

    <name>common-synch-clone</name>
    <description>This is the com.local.jira.plugin.common.action:common-synch-clone plugin for Atlassian 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>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>

        <!-- 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>
        -->
    </dependencies>

 <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>6.1.0</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.data.version}</productDataVersion>
					<instructions>
						<Bundle-ClassPath>.,META-INF/lib/spring-jdbc-${spring.version}.jar,META-INF/lib/spring-tx-${spring.version}.jar,META-INF/lib/mysql-connector-java-5.1.10.jar,META-INF/lib/jtds-1.2.4.jar</Bundle-ClassPath>
					</instructions>
					<supportedProjectTypes>
						<supportedProjectType>bundle</supportedProjectType>
					</supportedProjectTypes>					
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependency</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}/META-INF/lib</outputDirectory>
                            <includeArtifactIds>spring-jdbc,spring-tx,mysql-connector-java,jtds</includeArtifactIds>
                            <stripVersion>false</stripVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <jira.version>7.2.2</jira.version>
        <amps.version>6.2.11</amps.version>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
        <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>
    </properties>

</project>

For point 2: where are we initializing all the final variable which we are passing to super()?

initialized all variables in constructor, no luck

public class CloneIssueDetails extends com.atlassian.jira.web.action.issue.CloneIssueDetails{
	
	private final final long serialVersionUID = 7280519307582514363L;

	
	private final Logger log = Logger.getLogger(CloneIssueDetails.class);
        
        private static TaskDescriptorBean.Factory fc;

	private final ApplicationProperties applicationProperties;

	private final PermissionManager permissionManager;
	
	private final IssueLinkManager issueLinkManager;

	private final IssueLinkTypeManager issueLinkTypeManager;

	private final SubTaskManager subTaskManager;

	private final AttachmentManager attachmentManager;

	private final FieldManager fieldManager;

	private final IssueFactory issueFactory;
	
	private final IssueCreationHelperBean issueCreationHelperBean;
	
	private final TaskManager taskManager;
	
	private final IssueService issueService;
	
	private final TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator;

private final PropertyReader config;
private static TaskDescriptorBean.Factory fc;
	public CloneIssueDetails(
 final ApplicationProperties applicationProperties,
 final PermissionManager permissionManager,
 final IssueLinkManager issueLinkManager,
 final IssueLinkTypeManager issueLinkTypeManager,
 final SubTaskManager subTaskManager,
 final AttachmentManager attachmentManager,
 final FieldManager fieldManager,
 final IssueFactory issueFactory,
 final IssueCreationHelperBean issueCreationHelperBean,
final TaskManager taskManager,
final IssueService issueService,	
final TemporaryAttachmentsMonitorLocator temporaryAttachmentsMonitorLocator
)
	  {	
super(applicationProperties, permissionManager, issueLinkManager, issueLinkTypeManager, subTaskManager, attachmentManager, fieldManager, issueCreationHelperBean, issueFactory, issueService, temporaryAttachmentsMonitorLocator, taskManager,fc );
		config = PropertyReader.getInstance();
this.issueService = issueService;
this.taskManager = taskManager;
this.fc = fc;
.
.
. all private variables

For point to - you get them passed in the constructor. The Spring-DM/OSGi framework will do it all for you.

Since you’re using - can you remove the


        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>runtime</scope>
        </dependency>
``` ? (you don't need them since you're not using the spring scanner)

After that I would suggest maybe working through the osgi instructions that you're setting in the maven-jira-plugin. What you're hitting is all osgi's stuff and you've got a some non-out-of-the-box settings in the configuration block which could be messing with you.

After that - I'm out of ideas :frowning:

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