You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by ext2 <xu...@tongtech.com> on 2011/06/02 05:37:23 UTC
How to find a bundle's classloader in a extender ?
Hi:
I am writing a extender program which will listen the bundle start
event; and each bundle will contains a configuration file which describe
some java class of bundle to be launched;
But when the extender received the bundle start event. Then I have
no idea about how to get the bundle's class loader to loading class by name;
I check the osgi-specification and haven't find the API to got class
loader from bundle or bundleContext;
Doest anyone know something about this ?
thanks for any suggestion
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: How to find a bundle's classloader in a extender ?
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/2/11 0:40, ext2 wrote:
> Thanks Richard:
> Sorry, forgive me;
> I mis-read your reply as my pool English;
> Bundle.loadClass() is enough for spring-dm
Yes, that should be sufficient. There aren't too many reasons why you
must have the bundle's actual class loader, since the Bundle object
exposes a similar set of methods to access the bundle's content.
-> richard
>
>> -----original -----
>>
>>
>> Thanks Richard
>>
>> It seems there is no way to do this in a normal ways; :(
>> But I still feel confuse why the other extender do such a familiar
> function
>> based on felix. (etc: spring-dm and war extender will also initialize
> object
>> by application bundle's class).
>>
>> Does anyone know about this?
>>
>>
>>> ------------------------
>>> Sender: Richard S. Hall [mailto:heavy@ungoverned.org]
>>> Date: 2011/6/2 12:10
>>> Receiver: users@felix.apache.org
>>> Subject: Re: How to find a bundle's classloader in a extender ?
>>>
>>>
>>>
>>> On 06/01/2011 11:37 PM, ext2 wrote:
>>>> Hi:
>>>> I am writing a extender program which will listen the bundle start
>>>> event; and each bundle will contains a configuration file which
> describe
>>>> some java class of bundle to be launched;
>>>> But when the extender received the bundle start event. Then I have
>>>> no idea about how to get the bundle's class loader to loading class by
>> name;
>>>> I check the osgi-specification and haven't find the API to got class
>>>> loader from bundle or bundleContext;
>>>> Doest anyone know something about this ?
>>> If you just want to load a class from a bundle, you can use
>>> Bundle.loadClass()...in the R4.3 spec there is a way to get the actual
>>> class loader, but Felix doesn't yet support R4.3...
>>>
>>> -> richard
>>>
>>>> thanks for any suggestion
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: How to find a bundle's classloader in a extender ?
Posted by ext2 <xu...@tongtech.com>.
Thanks Richard:
Sorry, forgive me;
I mis-read your reply as my pool English;
Bundle.loadClass() is enough for spring-dm
> -----original -----
>
>
> Thanks Richard
>
> It seems there is no way to do this in a normal ways; :(
> But I still feel confuse why the other extender do such a familiar
function
> based on felix. (etc: spring-dm and war extender will also initialize
object
> by application bundle's class).
>
> Does anyone know about this?
>
>
> > ------------------------
> > Sender: Richard S. Hall [mailto:heavy@ungoverned.org]
> > Date: 2011/6/2 12:10
> > Receiver: users@felix.apache.org
> > Subject: Re: How to find a bundle's classloader in a extender ?
> >
> >
> >
> > On 06/01/2011 11:37 PM, ext2 wrote:
> > > Hi:
> > > I am writing a extender program which will listen the bundle start
> > > event; and each bundle will contains a configuration file which
describe
> > > some java class of bundle to be launched;
> > > But when the extender received the bundle start event. Then I have
> > > no idea about how to get the bundle's class loader to loading class by
> name;
> > > I check the osgi-specification and haven't find the API to got class
> > > loader from bundle or bundleContext;
> > > Doest anyone know something about this ?
> >
> > If you just want to load a class from a bundle, you can use
> > Bundle.loadClass()...in the R4.3 spec there is a way to get the actual
> > class loader, but Felix doesn't yet support R4.3...
> >
> > -> richard
> >
> > > thanks for any suggestion
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: How to find a bundle's classloader in a extender ?
Posted by ext2 <xu...@tongtech.com>.
Thanks Richard
It seems there is no way to do this in a normal ways; :(
But I still feel confuse why the other extender do such a familiar function
based on felix. (etc: spring-dm and war extender will also initialize object
by application bundle's class).
Does anyone know about this?
> ------------------------
> Sender: Richard S. Hall [mailto:heavy@ungoverned.org]
> Date: 2011/6/2 12:10
> Receiver: users@felix.apache.org
> Subject: Re: How to find a bundle's classloader in a extender ?
>
>
>
> On 06/01/2011 11:37 PM, ext2 wrote:
> > Hi:
> > I am writing a extender program which will listen the bundle start
> > event; and each bundle will contains a configuration file which describe
> > some java class of bundle to be launched;
> > But when the extender received the bundle start event. Then I have
> > no idea about how to get the bundle's class loader to loading class by
name;
> > I check the osgi-specification and haven't find the API to got class
> > loader from bundle or bundleContext;
> > Doest anyone know something about this ?
>
> If you just want to load a class from a bundle, you can use
> Bundle.loadClass()...in the R4.3 spec there is a way to get the actual
> class loader, but Felix doesn't yet support R4.3...
>
> -> richard
>
> > thanks for any suggestion
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: How to find a bundle's classloader in a extender ?
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 06/01/2011 11:37 PM, ext2 wrote:
> Hi:
> I am writing a extender program which will listen the bundle start
> event; and each bundle will contains a configuration file which describe
> some java class of bundle to be launched;
> But when the extender received the bundle start event. Then I have
> no idea about how to get the bundle's class loader to loading class by name;
> I check the osgi-specification and haven't find the API to got class
> loader from bundle or bundleContext;
> Doest anyone know something about this ?
If you just want to load a class from a bundle, you can use
Bundle.loadClass()...in the R4.3 spec there is a way to get the actual
class loader, but Felix doesn't yet support R4.3...
-> richard
> thanks for any suggestion
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org