Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Classloader question

Hi Thomas!

I have converted 'jabsorb' (JSON RPC bridge) into a bundle. One of the things it does is that it performs unmarshalling strings actual java objects. When it does that, it calls Class.forName(cn) so it will use the defining classloader of the caller class. My question is, how can I make this classloader aware of classes that resides in other bundles? Is it at all possible or will I be forced to refrain from having jabsorb in a bundle and instead use a jar embedded in some other bundle with a wider classloader scope to make this happen?

I think you would have different options:

Option 1: "DynamicImport-Package: *" to the manifest of your json bundle. This is one possible pure OSGi solution and should do what you want.

Option 2: If you are using Equinox as OSGi implementation you could also take a look at the Buddy-Loading mechanism:

http://help.eclipse.org/help33/topic/org.eclipse.platform.doc.isv/reference/misc/buddy_loading.html


HTH,
-Martin



Back to the top