Adding License support causes a plugin do not work (without any reasonable reason) ( and once more...)

Hi,

My plugin was working without any problem. It adds a menu under the admin_plugins_menu section which requires admin privileges trough the JiraGlobalPermissionCondition class as usual:

  <web-item key="subversion-repositories-link" name="Subversion repositories link on administrators page" section="admin_plugins_menu/source_control" weight="95">
    <label key="subversion.repositories"/>
    <condition class="com.atlassian.jira.plugin.webfragment.conditions.JiraGlobalPermissionCondition">
      <param name="permission">admin</param>
    </condition>
    <link linkId="subversion-repositories">/secure/ViewSubversionRepositories.jspa</link>
  </web-item>

Then added the license module by using the command line (the Plugin SDK version is the latest 4.2.9)...

atlas-create-jira-plugin-module &gt; 11

... and the plug-in cannot be loaded anymore because the exception below:

Caused by: com.atlassian.plugin.web.conditions.ConditionLoadingException: Could not load 'com.atlassian.jira.plugin.webfragment.conditions.JiraGlobalPermissionCondition' in plugin com.kintosoft.jira.subversion-plus
	at com.atlassian.jira.plugin.webfragment.JiraWebFragmentHelper.loadCondition(JiraWebFragmentHelper.java:50)
	at com.atlassian.plugin.web.descriptors.AbstractWebFragmentModuleDescriptor$1.create(AbstractWebFragmentModuleDescriptor.java:169)
	at com.atlassian.plugin.web.descriptors.ConditionElementParser.makeCondition(ConditionElementParser.java:151)
	... 249 more
Caused by: java.lang.IllegalStateException: Cannot autowire object because the Spring context is unavailable. Ensure your OSGi bundle contains the 'Spring-Context' header.
	at com.atlassian.plugin.osgi.factory.OsgiPluginInstalledHelper.autowire(OsgiPluginInstalledHelper.java:118)
	at com.atlassian.plugin.osgi.factory.OsgiPlugin.autowire(OsgiPlugin.java:331)
	at com.atlassian.plugin.osgi.factory.OsgiPlugin.autowire(OsgiPlugin.java:321)
	at com.atlassian.jira.plugin.PluginInjector.newInstance(PluginInjector.java:30)
	at com.atlassian.jira.plugin.webfragment.JiraWebFragmentHelper.loadCondition(JiraWebFragmentHelper.java:46)
	... 251 more

The Spring-Context is present in the pom.xml:

                   <instructions>
                        <Import-Package>javax.servlet.jsp*;version="0.0.0", org.springframework.context.annotation*;version="0.0.0", javax.annotation*;version="0.0.0", javax.sql*;version="0.0.0", javax.naming*;version="0.0.0", org.apache.commons.lang*;version="2.5", com.atlassian.jira.extension*;version="5.0", com.atlassian.jira.issue.tabpanels*;version="5.0", com.atlassian.jira.plugin.issuetabpanel*;version="5.0", com.atlassian.jira.plugin.projectpanel*;version="5.0", com.atlassian.jira.plugin.projectpanel.impl*;version="5.0", com.atlassian.jira.web.action*;version="5.0", com.atlassian.jira.web.action.issue*;version="5.0", com.atlassian.jira.web.bean*;version="5.0", com.atlassian.jira.project*;version="5.0", com.atlassian.jira.project.browse*;version="5.0", com.atlassian.core.util*;version="4.6.2", org.apache.commons.collections.map*;version="3.2.1", javax.net.ssl*;version="0.0.0", javax.servlet.http*;version="0.0.0", javax.xml.parsers*;version="0.0.0", webwork.action*;version="1.4-atlassian-22", webwork.action.factory*;version="1.4-atlassian-22", com.opensymphony.util*;version="2.2.7-atlassian-1", org.xml.sax*;version="0.0.0", org.xml.sax.helpers*;version="0.0.0", org.springframework.beans.factory*;version="2.5.6", com.atlassian.sal.api.lifecycle*;version="2.0.0", *;version="0.0.0";resolution:=optional</Import-Package>
                        <Spring-Context>*;timeout:=60</Spring-Context>                         <Private-Package>com.atlassian.upm.license.storage.lib*</Private-Package>
                        <DynamicImport-Package>com.atlassian.upm.api.license.entity;version="2.0.1", com.atlassian.upm.api.license;version="2.0.1", com.atlassian.upm.api.util;version="2.0.1", com.atlassian.upm.license.storage.plugin;version="${upm.license.compatibility.version}"</DynamicImport-Package>
                    </instructions>

Does anyone know why simply by add-ing the license support then a code which was running without any problem, suddenly stops to work?

What is the relationship among the JiraGlobalPrmissionConditon, the UPM/license module and Spring?

Thanks,

Pablo

1 answer

This widget could not be displayed.

Yeap, I was aware of this documentation. Anyway, an Atlassian's engineer provided me an alternative licensing API which is pretty much easier and stable compared with the official documentation. Since that, add-ing a license has become a trivial task and no more headaches :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

508 views 3 18
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