Which confluence artifact has the LicenseService class


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

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


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 Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

457 views 8 27
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