cannot squash ClassNotFoundException: ThirdPartyPluginLicenseStorageManagerImpl

Brendan Patterson
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.
March 5, 2014

OK back to build AddOns versus PluginLicensing not found......round #57.....fight!!

Though my plugin has been building and deploying pretty reliably for a year I needed to add some new static references to my code which seems to be throwing off the loading of the LicensingAPI

And though intermittent this issue persists:

Exception in thread "ThreadPoolAsyncTaskExecutor::Thread 49" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl] for bean with name 'thirdPartyPluginLicenseStorageManager' defined in URL [bundle://202.0:0/META-INF/spring/atlassian-plugins-components.xml]; nested exception is java.lang.ClassNotFoundException: com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl not found from bundle [net.artemissoftware.plugins.conf.multiexcerpt4.multiexcerpt-conf-plugin-4]
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)

I've got most of the latest stuff I think.

Confluence 5.3

AMPS 4.2.18

I have followed this so many times I can almost recite it: Alternate Deployment Model for Licensed Plugins

https://developer.atlassian.com/display/MARKET/Alternate+Deployment+Model+for+Licensed+Plugins

I am deploying an OBR, but no joy.

Here is my pom.xml - built for OBR deployment

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>net.artemissoftware.plugins.conf.multiexcerpt4</groupId>
    <artifactId>multiexcerpt-conf-plugin-4</artifactId>
    <version>4.7.1</version>
    <name>Multiexcerpt Plugin4</name>
    <packaging>atlassian-plugin</packaging>
    <description>MultiExcerpt suite</description>
    <url>http://www.artemissoftware.net</url>
    <organization>
        <name>Artemis Software</name>
        <url>https://artemis.atlassian.net/wiki/display/CMEP/Confluence+Multi-Excerpt+Plugin+Home</url>
    </organization>
     <build>
         <plugins>
             <plugin>
                 <groupId>com.atlassian.maven.plugins</groupId>
                 <artifactId>maven-confluence-plugin</artifactId>
                 <version>${amps.version}</version>
                 <extensions>true</extensions>
                 <configuration>
                     <productVersion>${confluence.version}</productVersion>
                     <productDataVersion>${confluence.data.version}</productDataVersion>
                     <instructions>
                         <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>
                     <bundledArtifacts>
                         <bundledArtifact>
                             <groupId>com.atlassian.upm</groupId>
                             <artifactId>plugin-license-storage-plugin</artifactId>
                             <version>${upm.license.compatibility.version}</version>
                         </bundledArtifact>
                     </bundledArtifacts>
                     <pluginDependencies>
                         <pluginDependency>
                             <groupId>com.atlassian.upm</groupId>
                             <artifactId>plugin-license-storage-plugin</artifactId>
                         </pluginDependency>
                     </pluginDependencies>
                 </configuration>
             </plugin>
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                     <source>1.6</source>
                     <target>1.6</target>
                 </configuration>
             </plugin>
             <plugin>
                 <artifactId>maven-dependency-plugin</artifactId>
                 <executions>
                     <execution>
                         <id>copy-storage-plugin</id>
                         <phase>process-resources</phase>
                         <goals>
                             <goal>copy-dependencies</goal>
                         </goals>
                         <configuration>
                             <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                             <includeArtifactIds>plugin-license-storage-plugin</includeArtifactIds>
                             <stripVersion>true</stripVersion>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
     </build>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>plugin-license-storage-lib</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>compile</scope>
            <!-- intentionally compile scoped -->
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>plugin-license-storage-plugin</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>licensing-api</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>upm-api</artifactId>
            <version>${upm.license.compatibility.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <version>2.8.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.osgi</groupId>
            <artifactId>spring-osgi-core</artifactId>
            <version>1.1.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <version>1.0.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.4</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.usercompatibility</groupId>
            <artifactId>usercompatibility-sal</artifactId>
            <version>0.5</version>
        </dependency>
    </dependencies>
    <properties>
         <confluence.version>5.4.3</confluence.version>
         <confluence.data.version>5.4.3</confluence.data.version>
         <amps.version>4.2.18</amps.version>
         <plugin.testrunner.version>1.1.4</plugin.testrunner.version>
         <upm.license.compatibility.version>2.4.1</upm.license.compatibility.version>
         <sal.api.version>2.4.0</sal.api.version>
         <atlassian.templaterenderer.version>1.0.5</atlassian.templaterenderer.version>
        <atlassian.plugin.key>net.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro</atlassian.plugin.key>

        <ao.version>0.19.7</ao.version>
        <upm.license.compatibility.version>2.14</upm.license.compatibility.version>

     </properties>
</project>

some component-imports and declarations from my atlassian-plugin.xml:

<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="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties"/>
    <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="pluginLicenseManager" interface="com.atlassian.upm.api.license.PluginLicenseManager"/>

    <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"/>

My guess is that there is something subtle I'm missing. From a process improvement statndpoint is there anything I can do to avoid this one single persistent error I've run into dozens of times since the MarketPlace was launched? My plugin was actually the second one available to the MarketPlace and its been a constant effort ever since to avoid this specific error. I will acknowledge it 'could just be me', but of course lots of developers have the same issue typically fixed.

What I would LOVE is an up to date working pom.xml and atlassian-plugin.xml reference with the declarations needed for licensing and OBR deployment.

Appreciate the help!

thanks!

Brendan

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
BenW
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2014

A few thoughts:

  • You should also have the following declaration in your plugin xml. Version 2.14 of the Plugin License Storage Plugin requires it. Note that you may have this and just didn't include it in your copy/paste.
    <component key="compatibilityUserManager" class="com.atlassian.sal.usercompatibility.impl.CompatibilityUserManager" />
  • Can you provide a more complete stacktrace? The class which is reported missing is provided by the "plugin-license-storage-lib" artifact and should always be present as you're compile-scoping it.
  • If you don't mind bumping your lower-end compatibility to Confluence 4.1.7+, I recommend you start using the licensing API provided by UPM 2.x instead of the Plugin License Storage Plugin API. This newer API doesn't have as far-reaching compatibility but is much more stable. We're fixing up a tutorial which better describes this, and I'll link to it when it is ready.
Brendan Patterson
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.
March 5, 2014

Hi Ben,

Firstly - you rock. Thanks so much for looking at this and everyone elses' similar PluginLicening issues.

  • "If you don't mind bumping your lower-end compatibility to Confluence 4.1.7+, I recommend you start using the licensing API provided by UPM 2.x instead of the Plugin License Storage Plugin API. This newer API doesn't have as far-reaching compatibility but is much more stable. We're fixing up a tutorial which better describes this, and I'll link to it when it is ready."

YES! A thousand times yes :) Is anything like that ready to preview? Happy to jump in on that with both feet. I was hoping to avoid this type of issue with a new completely 'provided' api.

Can you provide a more complete stacktrace?

Sorry I should have provided that. I now just ripped out all my licensing code, re-wrote the pom.xml for the nth time and am now trying to put humpty dumpty back together.

  • You should also have the following declaration in your plugin xml. Version 2.14 of the Plugin License Storage Plugin requires it. Note that you may have this and just didn't include it in your copy/paste.
    <component key="compatibilityUserManager" class="com.atlassian.sal.usercompatibility.impl.CompatibilityUserManager" />

I did have that but it was not being found at runtime. Perhaps that's another one of my problems. And this is not added by the atlas-create-confluence-plugin-module command for adding licensing. That used to be a reasonable reference but is now usually out of date.

I'm sure to run into the stacktrace again shortly and will post it.

In the meantime if you can hook a brother up with how to use "licensing API provided by UPM 2.x " I think that might make my week :)

Brendan Patterson
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.
March 6, 2014

Here is my latest pom.xml - I think it's basically the same as above but wanted to include a reference to it just in case: http://pastebin.com/LDrVLC3w (no gist on BitBucket yet?)

Thanks for the help! I created a fix for a customer, but can't send it till I work this out. Alas!

Here is the complete error log - I have to stick it in pastebin because answers.atlassian.comwon't let me add more the 2000 chars:

http://pastebin.com/hYH11KLX

Here is some of it:

2014-03-06 15:02:20,516 INFO [http-8090-9] [atlassian.plugin.manager.DefaultPluginManager] disableDependentPlugins Found dependent enabled plugins for uninstalled plugin 'biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro': []. Disabling...

2014-03-06 15:03:15,967 ERROR [ThreadPoolAsyncTaskExecutor::Thread 54] [plugin.osgi.factory.OsgiPlugin] onPluginContainerFailed Unable to start the plugin container for plugin biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro

-- referer: http://localhost:8090/plugins/servlet/upm| url: /rest/plugins/1.0/ | userName: admin

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl] for bean with name 'thirdPartyPluginLicenseStorageManager' defined in URL [bundle://210.0:0/META-INF/spring/atlassian-plugins-components.xml]; nested exception is java.lang.ClassNotFoundException: com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManagerImpl not found from bundle [net.artemissoftware.plugins.conf.multiexcerpt4.multiexcerpt-conf-plugin-4]

at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)

BenW
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2014

Here is the link I promised: https://developer.atlassian.com/display/MARKET/Tutorial%3A+Adding+licensing+support+to+your+add-on

Once configured in your pom.xml and atlassian-plugin.xml, the Java API (PluginLicenseManager) pretty much works the same way as the previous API's equivalent class (ThirdPartyPluginLicenseStorageManager). The one main difference is that this API does not offer mutative methods as mutative actions should all go through UPM's UI.

1 vote
Brendan Patterson
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.
March 6, 2014

Ben,

Thanks so much for sending this! I am very excited. And it works! :) I've integrated it into my plugin.

Aside from giving you a bit of 'Answers karma' I thought another way I could say thank you was to beef up the tutorial example in BitBucket a little bit since it did not have any actual license checking code. So I forked and submitted a pull request - love that feature:

https://bitbucket.org/atlassian_tutorial/tutorial-licensing/pull-request/1/adding-code-to-check-for-a-valid-license/diff

Muchas gracias!

TAGS
AUG Leaders

Atlassian Community Events