ComponentAccessor not initialised

I have a problem with ComponentAccessor that has not been initialised, I already check on multiple references on how to fix this and use the Mockito container but all sources are not clear. This is not for a unit test. Can you provide me some information and examples on how to initialize ComponentAccessor?
This is for a java maven spring plugin with atlassian connect and I can provide more information if needed.

Here is the output:
java.lang.IllegalStateException: ComponentAccessor has not been initialised.

This is not expected to occur on a production system.
Developers that encounter this message within a unit test
should use n MockitoMocksInContainer rule to initialize mockito and ComponentAccessor.
For more detailed explanation read the documentation
for MockComponentWorker in the jira-tests artifact for more information
about what causes this error and how to address it.

    at com.atlassian.jira.component.ComponentAccessor.getWorker(
    at com.atlassian.jira.component.ComponentAccessor.getComponent(
    at com.atlassian.jira.component.ComponentAccessor.getJiraAuthenticationContext(

I understand you are trying to run JIRA code in maven plugin. I would strongly encourage you not to do so as you maybe risking violating

If you are sure you will be OK wit the license, then most probably you want to initialise ComponentAccessor with objects that you need.
To do so you will have to execute:

final MockComponentWorker componentAccessorWorker = new MockComponentWorker();
1 Like

Hey, I am trying to write a Junit test to test my Jira plugin. Should I be worried about the customer agreement?

1 Like