Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Bundle context class loader in Component:activate/deactivate and Bundle:start/stop

You should be able to do Class.forName("someClass") in your activate 
method. This will use the classloader of the class which defined the 
activate method which should be your bundle's classloader.

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargrave@xxxxxxxxxx
Office: +1 407 849 9117 Mobile: +1 386 848 3788



Ravindar Reddy <rroopreddy@xxxxxxxxx> 
Sent by: equinox-dev-bounces@xxxxxxxxxxx
07/06/2006 02:13 PM
Please respond to
Ravindar Reddy <rroopreddy@xxxxxxxxx>; Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>


To
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
cc

Subject
[equinox-dev] Bundle context class loader in Component:activate/deactivate 
and Bundle:start/stop






I am running into an issue with bundle context class loader
1. I have some library code that dynamically loads classes using 
contextClassLoader or an explicitly set ClassLoader.
2. This code is triggered in  Component.activate() (I think same behaviour 
in Bundle.start() )
3. The classes I am loading are appropriately imported in bundle manifest 
and are visible in bundle loader

I get ClassNotFoundException. It seems like the current thread class 
loader is not set to the bundle class loader instead set to something else 
(ContextFinder or FrameworkClassLoader). I also tried 
bundle.getClass().getClassLoader() and it does not point to bundle loader 
either.

I have couple of questions on this:

1) Is the activate/deactivate (or start/stop) supposed to run in "bundle 
context loader". Have not seen any references in OSGI spec on this
2) Is there a standard API to get the Bundle ClassLoader to satisfy above 
need
3) Any other approach to addres the issue

Thanks,
-Ravi R

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev




Back to the top