I understand that you resolved the issue, but I am not sure that this is the best approach in the long run. I have some suggestions for different approaches too, but these are not good for the long run either.

1. Since the default class path for a bundle is ".", you should be able to load your plugin class directly from Bundle.loadClass(), I would imagine.

2. You could create a special installer that you used to install your plugin JAR file instead of doing it directly with BundleContext.installBundle(). This special installer could automatically run them plugin JARs through BND.

Long run, you probably want to migrate the plugins to bundles in some fashion.

-> richard

On Feb 21, 2008, at 9:40 PM, Mike Smoot wrote:

Hi,

I'm working on migrating an existing swing application (http://cytoscape.org ) to OSGi using Felix. With the help of bnd, I've gotten everything running about how it should, with the exception of our legacy plugin mechanism. The way the old plugin mechanism works is that a plugin jar file (but not a bundle) is read and we then call ClassLoader.loadClass() on a class found in the jar file. The problem is that with Felix I get a NoClassDefFoundError when I try to load the class. I'm assuming this is because none of the packages defined in the plugin jar are found by Felix since the plugin jars
aren't bundles or loaded as such.

Now, I've managed to work around this problem in two cases. First is using Equinox, which I'm not terribly keen on using. Second is by running bnd on each plugin jar, loading them as bundles, jumping through a few hoops to get the correct ClassLoader, and then loading the class. The problem with the second approach is that I have to wrap all plugins before anything will work. I'd very much like to avoid this requirement (for now) because this will only work with plugins that I have and not those developed by users.

Can anyone provide any guidance on loading classes that aren't part of
bundles? Is this possible with Felix? I apologize if this is a bit vague,
but I'm still very new to OSGi.

thanks,
Mike

--
____________________________________________________________
Michael Smoot, Ph.D. Bioengineering Department
tel: 858-822-4756 University of California San Diego


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to