OSGi classloader issues

Dheeraj Kumar Aggarwal October 11, 2011

Hi Geeks,

I am very new to OSGi.

I am developing a JIRA plugin, suppose A which depends on libraries, suppose B-1.0 and C-1.0. Now If the library C-1.0 depends on library B-2.0 (Note: the different version of library B). So my plugin has two different versions of the library B in its classpath. Now, How can I handle this situation ?

As I studied from last 4-5 days about OSGi that it creates a classloader for each plugin in the JIRA application, so that dependency version mismatch do not occur between plugins. But What would a developer do If a plugin itself needs two different versions of a library jar ?

Can I create two different classloaders in a single plugin through OSGi, say one for package X and another one for package Y ?

Please help me in any of the above scenarios or point me to the right direction.

Thanks in advance.

1 answer

0 votes
Stefan Saasen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 14, 2011

Can I create two different classloaders in a single plugin through OSGi, say one for package X and another one for package Y ?

I'm afraid OSGi doesn't help you with this. In an OSGi container every bundle (and an Atlassian plugin is a bundle in OSGi land) gets its own bundle classloader but no more.

Could you be more explicit with your examples? Apart from changing A to compatible with B-2.0 I can't see a way to solve your problem.


Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events