Which confluence artifact has the LicenseService class

Hello,

I need to access the Confluence license properties and need to inject LicenseService class. I need to know which maven dependence I need to add?

1 answer

This widget could not be displayed.

It's in confluence-5.0.3.jar itself ;)

<dependency>
      <groupId>com.atlassian.confluence</groupId>
      <artifactId>confluence</artifactId>
      <version>${confluence.version}</version>
      <scope>provided</scope>
    </dependency>

It should be the same file across all versions, 5.0.3, 4.3, 5.3...

$ unzip -l /.../.m2/repository/com/atlassian/confluence/confluence/5.0.3/confluence-5.0.3.jar  | grep LicenseService
     5022  03-14-13 22:40   com/atlassian/confluence/license/DefaultLicenseService.class
      657  03-14-13 22:40   com/atlassian/confluence/license/LicenseService.class

Hi Adrien,

I'm trying to inject the LicenseService in a test class. However, I'm getting this error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'licenseService': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/springframework/osgi/context/internal/classloader/ChainedClassLoader) previously initiated loading for a different type with name "com/atlassian/extras/api/Product"

I've got in my atlassian-plugin.xml

<component-import key="licenseService" interface="com.atlassian.confluence.license.LicenseService" name="License Service" public="true"/>

And the following in my atlassian-plugin.xml for testing

<component-import key="confluenceLicenseService" interface="com.atlassian.confluence.license.LicenseService" />

Any idea?

Thank you!

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...

428 views 3 17
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