ComponentAccessor has not been initialised

Ed Sattar September 1, 2013

I am getting error in REST plugin.

ComponentAccessor has not been initialised.

I am using static method ComponentAccessor.getComponent

5 answers

1 vote
RambanamP
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.
September 1, 2013

i think you have to try with getComponentOfType(Class<T> componentClass)

check this doc

https://docs.atlassian.com/jira/latest/com/atlassian/jira/component/ComponentAccessor.html

can you share your code ?

0 votes
RambanamP
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.
September 1, 2013

why can't you instialize this through constructor?

check here, in this class it is insitialized through constructor and used

https://bitbucket.org/topmanage/tm-project-templates/src/4e51f3d7e365/src/main/java/com/topmanage/jiraplugins/projecttemplates/ProjectCloner.java

0 votes
Marten Kreienbrock
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.
September 1, 2013

Just out of curiosity, where in your class are you trying to receive the ComponentAccessor?

0 votes
Ed Sattar September 1, 2013

I tried ComponentAccessor.getComponentOfType same error

0 votes
Ed Sattar September 1, 2013

import com.atlassian.jira.component.ComponentAccessor;

if (fieldConfigId != null)
{
FieldConfigManager fieldConfigManager = ComponentAccessor.getComponent(FieldConfigManager.class);
fieldConfig = fieldConfigManager.getFieldConfig(fieldConfigId);
}

RambanamP
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.
September 1, 2013

can you try with getComponentofType(FieldConfigManager.class) method

Suggest an answer

Log in or Sign up to answer