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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

847 views 2 9
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