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/21 10:55:49 UTC
How to specify a custom class loader as embedded felix's parent class loader?
Hi:
I am trying to embedded a felix framework in a application.
But the application will create a custom class loader, as make the launched
felix to use the class loader as its parent class loader.
1) Could anyone help me to explain how Felix framework know which
class loader is it's parent class loader? the caller's class loader, thread
context class loader or something else?
2) Is the way of choosing classloader used by felix same as equinox?
Does OSGI specification defined this?
Thanks any suggestion
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: How to specify a custom class loader as embedded felix's parent class loader?
Posted by ext2 <xu...@tongtech.com>.
Thanks Richard S. Hall:
Thanks you very much. I know it.
What you have point out is just I need: bundles need use class of host
application's specific class loader;
> -----Original-----
> Sender: Richard S. Hall [mailto:heavy@ungoverned.org]
> Date: 2011年6月21日 19:30
> Receiver: users@felix.apache.org
> Subject: Re: How to specify a custom class loader as embedded felix's
parent class
> loader?
>
> On 6/21/11 12:25, ext2 wrote:
> > Thanks Richard S. Hall.
> >
> >> The framework class must be loaded by a class loader by definition
> > What's "definition" really means?
>
> All classes are loaded by a class loader.
>
> >> There is no standard way to define the framework class loader or its
> >> parent. I don't think it would be possible to do this. However, it is
> >> possible to define the parent class loader for bundles
> >> (org.osgi.framework.bundle.parent or something property). This value is
> >> only important when it comes to boot delegation, which generally isn't
> >> used since it isn't very modular.
> >>
> > Is there any resource, I could find the exact property name? It seems
this
> > is what I want: passing the host application's class loader to Felix,
and
> > use it as system bundle's parent class loader.
>
> The OSGi spec or check the Felix framework usage document...
>
> The only reason why it is typically necessary to set the framework's
> parent class loader is if you want to export packages from the system
> bundle that are available on a specific class loader.
>
> -> richard
>
> >> -----Richard -----
> >> Sender: Richard S. Hall [mailto:heavy@ungoverned.org]
> >> Date: 2011/6/21 17:16
> >> Receiver: users@felix.apache.org
> >> Subject: Re: How to specify a custom class loader as embedded felix's
> > parent class
> >> loader?
> >>
> >> On 6/21/11 10:55, ext2 wrote:
> >>> Hi:
> >>> I am trying to embedded a felix framework in a application.
> >>> But the application will create a custom class loader, as make the
> > launched
> >>> felix to use the class loader as its parent class loader.
> >>>
> >>> 1) Could anyone help me to explain how Felix framework know which
> >>> class loader is it's parent class loader? the caller's class loader,
> > thread
> >>> context class loader or something else?
> >> The framework class must be loaded by a class loader by definition.
This
> >> is the class loader that the framework will delegate to when it comes
to
> >> exposing "system" packages.
> >>
> >>> 2) Is the way of choosing classloader used by felix same as equinox?
> >>> Does OSGI specification defined this?
> >> There is no standard way to define the framework class loader or its
> >> parent. I don't think it would be possible to do this. However, it is
> >> possible to define the parent class loader for bundles
> >> (org.osgi.framework.bundle.parent or something property). This value is
> >> only important when it comes to boot delegation, which generally isn't
> >> used since it isn't very modular.
> >>
> >> -> richard
> >>
> >>> Thanks 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 specify a custom class loader as embedded felix's parent
class loader?
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/21/11 12:25, ext2 wrote:
> Thanks Richard S. Hall.
>
>> The framework class must be loaded by a class loader by definition
> What's "definition" really means?
All classes are loaded by a class loader.
>> There is no standard way to define the framework class loader or its
>> parent. I don't think it would be possible to do this. However, it is
>> possible to define the parent class loader for bundles
>> (org.osgi.framework.bundle.parent or something property). This value is
>> only important when it comes to boot delegation, which generally isn't
>> used since it isn't very modular.
>>
> Is there any resource, I could find the exact property name? It seems this
> is what I want: passing the host application's class loader to Felix, and
> use it as system bundle's parent class loader.
The OSGi spec or check the Felix framework usage document...
The only reason why it is typically necessary to set the framework's
parent class loader is if you want to export packages from the system
bundle that are available on a specific class loader.
-> richard
>> -----Richard -----
>> Sender: Richard S. Hall [mailto:heavy@ungoverned.org]
>> Date: 2011/6/21 17:16
>> Receiver: users@felix.apache.org
>> Subject: Re: How to specify a custom class loader as embedded felix's
> parent class
>> loader?
>>
>> On 6/21/11 10:55, ext2 wrote:
>>> Hi:
>>> I am trying to embedded a felix framework in a application.
>>> But the application will create a custom class loader, as make the
> launched
>>> felix to use the class loader as its parent class loader.
>>>
>>> 1) Could anyone help me to explain how Felix framework know which
>>> class loader is it's parent class loader? the caller's class loader,
> thread
>>> context class loader or something else?
>> The framework class must be loaded by a class loader by definition. This
>> is the class loader that the framework will delegate to when it comes to
>> exposing "system" packages.
>>
>>> 2) Is the way of choosing classloader used by felix same as equinox?
>>> Does OSGI specification defined this?
>> There is no standard way to define the framework class loader or its
>> parent. I don't think it would be possible to do this. However, it is
>> possible to define the parent class loader for bundles
>> (org.osgi.framework.bundle.parent or something property). This value is
>> only important when it comes to boot delegation, which generally isn't
>> used since it isn't very modular.
>>
>> -> richard
>>
>>> Thanks 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 specify a custom class loader as embedded felix's parent class loader?
Posted by ext2 <xu...@tongtech.com>.
Thanks Richard S. Hall.
>The framework class must be loaded by a class loader by definition
What's "definition" really means?
> There is no standard way to define the framework class loader or its
> parent. I don't think it would be possible to do this. However, it is
> possible to define the parent class loader for bundles
> (org.osgi.framework.bundle.parent or something property). This value is
> only important when it comes to boot delegation, which generally isn't
> used since it isn't very modular.
>
Is there any resource, I could find the exact property name? It seems this
is what I want: passing the host application's class loader to Felix, and
use it as system bundle's parent class loader.
> -----Richard -----
> Sender: Richard S. Hall [mailto:heavy@ungoverned.org]
> Date: 2011/6/21 17:16
> Receiver: users@felix.apache.org
> Subject: Re: How to specify a custom class loader as embedded felix's
parent class
> loader?
>
> On 6/21/11 10:55, ext2 wrote:
> > Hi:
> > I am trying to embedded a felix framework in a application.
> > But the application will create a custom class loader, as make the
launched
> > felix to use the class loader as its parent class loader.
> >
> > 1) Could anyone help me to explain how Felix framework know which
> > class loader is it's parent class loader? the caller's class loader,
thread
> > context class loader or something else?
>
> The framework class must be loaded by a class loader by definition. This
> is the class loader that the framework will delegate to when it comes to
> exposing "system" packages.
>
> > 2) Is the way of choosing classloader used by felix same as equinox?
> > Does OSGI specification defined this?
>
> There is no standard way to define the framework class loader or its
> parent. I don't think it would be possible to do this. However, it is
> possible to define the parent class loader for bundles
> (org.osgi.framework.bundle.parent or something property). This value is
> only important when it comes to boot delegation, which generally isn't
> used since it isn't very modular.
>
> -> richard
>
> > Thanks 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 specify a custom class loader as embedded felix's parent
class loader?
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/21/11 10:55, ext2 wrote:
> Hi:
> I am trying to embedded a felix framework in a application.
> But the application will create a custom class loader, as make the launched
> felix to use the class loader as its parent class loader.
>
> 1) Could anyone help me to explain how Felix framework know which
> class loader is it's parent class loader? the caller's class loader, thread
> context class loader or something else?
The framework class must be loaded by a class loader by definition. This
is the class loader that the framework will delegate to when it comes to
exposing "system" packages.
> 2) Is the way of choosing classloader used by felix same as equinox?
> Does OSGI specification defined this?
There is no standard way to define the framework class loader or its
parent. I don't think it would be possible to do this. However, it is
possible to define the parent class loader for bundles
(org.osgi.framework.bundle.parent or something property). This value is
only important when it comes to boot delegation, which generally isn't
used since it isn't very modular.
-> richard
> Thanks 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