Jira plugin not enabling after Jira restart

Posted by:

Sometimes when developing a Jira plugin which creates customfields on installation, it does not enable automatically when Jira app is restarted, the reason being that the code which is used to add the customfields implemented from the class :InitializingBean, maybe with the class :DisposableBean. To remove somethings on plugin disable/uninstall as follows:

public class MyPluginInstaller implements InitializingBean,

DisposableBean { 


    public void destroy() throws Exception {

        // do nothing



    public void afterPropertiesSet() throws Exception {

        // then the code for adding customfields goes in here



Now what happens is that at the time the method : afterPropertiesSet() is run, the customfied manager is not fully instantiated and thus fails to add customfields or get customfields which are already in the system on Jira app restart.

However this works fine when the plugin is being installed on a running Jira app, because everything is running perfectly.

Now to fix this problem is easy, the class : LifecycleAware has to be implemented, and the method : onStart() has to be over ridden as follows :

public class MyPluginInstaller implements LifecycleAware { 


 public void onStart() {

    // the code for adding the customfields is put here



Now the class LifecycleAware is executed when everything is fully instantiated, so nothing fails and the plugin is enabled on Jira restart.


Interesting Infoware Studios Bookmarks


About the Author:

  Related Posts