Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

My plugin is missing service dependencies

George May 1, 2015

I'm trying to access the methods from LicenseDetails in my REST plugin - https://developer.atlassian.com/static/javadoc/jira/5.0.5/reference/com/atlassian/jira/license/LicenseDetails.html

 

I have used component-import from atlassian-plugin.xml to import it:

<component-import key="licenseDetails" interface="com.atlassian.jira.license.LicenseDetails"/>

Then in my plugins class, I've imported the same interface and used:

private myRestPlugin licenseDetails;
public myRestPlugin(LicenseDetails licenseDetails) {
    this.licenseDetails = licenseDetails;
}

 

However I'm getting these errors on startup of JIRA:

[INFO] [talledLocalContainer] 2015-05-01 12:02:44,926 localhost-startStop-1 ERROR      [plugin.osgi.factory.OsgiPlugin] Never resolved service '&licenseDetails' for plugin 'com.example.test-plugin' with filter (objectClass=com.atlassian.jira.license.LicenseDetails)
[INFO] [talledLocalContainer]     'com.example.test-plugin' - 'test-plugin'  failed to load.
[INFO] [talledLocalContainer]         The plugin has been disabled.  A likely cause is that it timed out during initialisation
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer]         It has the following missing service dependencies :
[INFO] [talledLocalContainer]              &licenseDetails of type (objectClass=com.atlassian.jira.license.LicenseDetails)

 

What is the proper way of doing this?

 

Cheers,

George

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Frédéric Tardieu
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.
May 1, 2015

Hi George,

Try by adding this to your pom.xml:

<component key="thirdPartyPluginLicenseStorageManager" class="com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl"/>
<component key="pluginLicenseStoragePluginInstaller" class="com.atlassian.upm.license.storage.lib.PluginLicenseStoragePluginInstaller" />

Cheers,

F.

George May 1, 2015

Hi Frédéric, Unfortunately adding those components to atlassian-plugin.xml yielded the same result, would there be any dependencies I'm missing from the pom.xml to access it? Appreciate your help. Cheers, George

Frédéric Tardieu
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.
May 1, 2015

Hi George, On which JIRA version are you building on? Can you copy paste your component import section from your pom.xml?

George May 1, 2015

Hi Frédéric, Version 6.3.13 - The only component-import line that exists in the atlassian-plugin.xml is the LicenseDetails one I've added (in the original post). In the actual project pom.xml, a component-import section doesn't exist. Thanks for your help! George

Frédéric Tardieu
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.
May 1, 2015

Hi George, In the <plugin-info> section of your pom.xml, try to add: <bundle-instructions> <DynamicImport-Package> com.atlassian.sal.usercompatibility.UserManager, com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManager, com.atlassian.upm.license.storage.lib.PluginLicenseStoragePluginInstaller, ;resolution:=optional </DynamicImport-Package> </bundle-instructions> Then try to add all these component imports: component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" /> <component-import key="pluginAccessor" interface="com.atlassian.plugin.PluginAccessor" /> <component-import key="pluginController" interface="com.atlassian.plugin.PluginController" /> <component-import key="txTemplate" interface="com.atlassian.sal.api.transaction.TransactionTemplate" /> <component-import key="templateRenderer" interface="com.atlassian.templaterenderer.TemplateRenderer" /> <component-import key="pluginSettingsFactory" interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory" /> <component-import key="loginUriProvider" interface="com.atlassian.sal.api.auth.LoginUriProvider" /> <component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager" /> <component-import key="i18nResolver" interface="com.atlassian.sal.api.message.I18nResolver" /> <component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects" /> <component key="compatibilityUserManager" class="com.atlassian.sal.usercompatibility.impl.CompatibilityUserManager" /> <component key="thirdPartyPluginLicenseStorageManager" class="com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl"/> <component key="pluginLicenseStoragePluginInstaller" class="com.atlassian.upm.license.storage.lib.PluginLicenseStoragePluginInstaller" /> <component key="atlassianMarketplaceUriFactory" class="com.atlassian.upm.license.storage.lib.AtlassianMarketplaceUriFactoryImpl" /> <component key="tx-processor" class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor" /> <component key="userprefs-service" class="com.tartech.deeper.ao.DeeperUserPreferenceServiceImpl" /> This is from my latest plugin, which is using UPM & Atlassian licensing management system... Hope this helps, Fred

George May 1, 2015

Hi Frédéric, Unfortunately I'm still getting the service dependency error, its quite strange :/ Are you using com.atlassian.jira.license.LicenseDetails in your plugin? Appreciate your help though. Cheers, George

Frédéric Tardieu
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.
May 1, 2015

Hi George, To knpw from inside my plugin if its license is valid, I'm using ThirdPartyPluginLicenseStorageManager like this: public static boolean isLicenseValid(ThirdPartyPluginLicenseStorageManager licenseManager) { try { if (licenseManager.getLicense().isDefined()) { PluginLicense pluginLicense = licenseManager.getLicense().get(); if (pluginLicense.getError().isDefined()) return false; else return pluginLicense.getExpiryDate().get().isAfterNow(); } else return false; } catch (PluginLicenseStoragePluginUnresolvedException pluginLicenseStoragePluginUnresolvedException) { return false; } }

TAGS
AUG Leaders

Atlassian Community Events