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
Community moderators have prevented the ability to post new answers.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi George, On which JIRA version are you building on? Can you copy paste your component import section from your pom.xml?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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; } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.