Unable to inject ComponentAccessor or EpicLinkManager (greenhopper) into my class

I have been trying to inject either the ComponentAccessor or EpicLinkManager into my constructor but run into some issues.

If I use EpicLinkManager in my constructor:

@Autowired
public MyWebworkModuleAction( @ComponentImport IssueService issueService, .....@ComponentImport EpicLinkManager epicLinkManager) {

after adding jira-greenhopper-plugin (6.7.4) from com.atlassian.jira.plugins to my pom.xml the atlas-run will compile and run it but the plugin will not be loaded (ie its web item is missing from the more menu).

If I use ComponentAccessor instead of the EpicLinkManager (to try to access EpicLinkManager over it) it hangs at atlas-run with a count down:

@Autowired
public MyWebworkModuleAction( @ComponentImport IssueService issueService, .....@ComponentImport ComponentAccessor componentAccessor) {

[INFO] [talledLocalContainer] 2017-11-29 09:21:34,689 localhost-startStop-1 INFO      [c.a.plugin.util.WaitUntil] Plugins that have yet to be enabled: (2): [com.xyx.xyz, com.xyzxyz.xyz-tests], 12 seconds remaining

Even though I might have issues with the greenhopper one I would expect that the ComponentAccessor would load without issues considering its more frequent used. None of the other components (like IssueLinkManager or PageBuilderService) I am injecting has any issues, its just these so far.

Anyone any ideas? Thanks!

1 answer

1 accepted

This widget could not be displayed.
Micky Caritte Community Champion Nov 29, 2017

Hi Martin,

ComponentAccessor is mainly a static accessor which means you can import its package and simply use it like:

ProjectManager pm = ComponentAccessor.getProjectManager();

I guess you can therefore use:

EpicLinkManager elm = ComponetAccessor.getComponentOfType(EpicLinkManager.class);

Hope this helps!

Thanks Micky, it worked for the ComponentAccessor but still no go on getting an instance of the EpicLinkManager. I posted another question solely about the EpicLinkManager as I suspect I am messing up somewhere. https://community.atlassian.com/t5/Jira-Software-questions/How-do-I-create-a-EpicLinkManagerImpl-instance/qaq-p/681536

This one is answered for the ComponentAccessor

Micky Caritte Community Champion Nov 30, 2017

Glad to hear it helped, will try and give you some input in the other thread!

Cheers

Doing it this way in my SpringBoot application I always get an Exception that the ComponentAccessor is not initialized.

  ComponentAccessor has not been initialised.

 Can anybody tell me what I have to do that the ComponentAccessort will be properly initialized in a SpringBoot environment? Finally, I want to access the CustomFieldManager to work upon CustomFields...

 

...

customfieldMap.forEach((k, v) -> {
CustomFieldManager cfm = ComponentAccessor.getComponent(CustomFieldManager.class);
CustomField cf = cfm.getCustomFieldObjectByName(k);
System.out.println(cf.getValue((com.atlassian.jira.issue.Issue)v));
...
}
...

 

I get this exception even when I explicitely autowire the ComponentAccessor with 

 private ComponentAccessor componentAccessor;

public void setComponentAccessor(final ComponentAccessor componentAccessor) {

    this.componentAccessor = componentAccessor;

}

...but the ComponentAccessor should be accessed in a static way anyway, shouldn't it!?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Apr 22, 2018 in Jira Software

How-to setup a secured Jira Software 7.9.0 on Ubuntu 16.04.4 in less than 30 minutes

...PermissionsStartOnly=true User=www-data Group=www-data ExecStart=/opt/jira/bin/startup.sh ExecStop=/opt/jira/bin/shutdown.sh TimeoutStartSec=120 TimeoutStopSec=600 PrivateTmp=true [Install] WantedBy...

1,511 views 10 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you