You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Andrea Turbati <tu...@info.uniroma2.it> on 2009/08/27 10:25:23 UTC

Instance of Felix inside a Felix bundle

Hi,
I'm trying to lunch a second Felix instance inside a Felix bundle, or to 
be more precise the second instance of felix is inside a jar which it's 
inside a bundle. So this is the situation:
I have the main program (MainProgram) which Felix is embedded. This 
MainProgram find and install various bundle and inside one of this 
(ParticularBundle) there are two jars, one (SpecialJar.jar) that starts 
another instance of Felix and another "normal" jar (NormalJar.jar). 
Naturally the Manifest of the ParticularBundle contains the following lines:

Bundle-ClassPath: .,
   lib/SpecialJar.jar,
   lib/NormalJar.jar

The second instance of Felix seems to start fine, but for some reasons 
it's able to export correctly (using Constants.FRAMEWORK_SYSTEMPACKAGES) 
only the packages which were imported with the manifest of 
ParticularBundle. This means that in ParticularBundle I can use all the 
classes that are contained in the two jars (SpecialJar.jar and 
NormalJar.jar), but all the bundle that are discovered and installed by 
the instance of Felix in SpecialJar.jar are able to use only the package 
exported by the first instance of Felix, imported by ParticularBundle 
and then exported by the second instance of Felix, but when they try to 
use a class of a package that belongs to SpecialJar.jar or NormalJar.jar 
and is exported by the second isntance of Felix they throw a 
java.lang.NoClassDefFoundError: my.package.MyClass (this should mean 
that the bundle is importing the package and that the socond instance of 
Felix it's exporting it).

I think that it is a classloader problem, but I really don't know how to 
solve it.

Regards,

Andrea Turbati

-- 

-------------------------------------------------
 
Dott. Andrea Turbati

AI Research Group PhD student,

Dept. of Computer Science, Systems and Production

University of Roma, Tor Vergata

Via del Politecnico 1 00133 ROMA (ITALY)

tel: +39 06 7259 7332 (lab)

e_mail: turbati@info.uniroma2.it

home page: http://art.uniroma2.it/turbati/

--------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Instance of Felix inside a Felix bundle

Posted by Andrea Turbati <tu...@info.uniroma2.it>.
Thank you, now it works.

Regards

Andrea

Karl Pauls ha scritto:
> Well, there you go then. You are importing the
> org.apache.felix.framework.* packages. This way the framework gets
> confused and is using the wrong classloader (I'd argue that this is
> something we should fix in felix but its more a feature then a bug).
>
> You did say that you embed the felix.jar inside your bundle. If that
> is the case then just put it on the bundle classpath and remove the
> imports for org.apache.felix.* from the bundle and that should make it
> work.
>
> regards,
>
> Karl
>
> On Thu, Aug 27, 2009 at 11:00 AM, Andrea
> Turbati<tu...@info.uniroma2.it> wrote:
>   
>> I'm using Felix 1.8.0.
>>
>> The Manifest of the bundle that embeds Felix is
>>
>>
>> Manifest-Version: 1.0
>> Bundle-Activator: it.uniroma2.art.stontoling.bundle.STOntoLingBundle
>> Bundle-ClassPath: .,
>> lib/LinguisticWatermark.jar,
>> lib/OntoLing_Core.jar,
>> Import-Package:
>> com.sun.org.apache.xerces.internal.dom,
>> com.sun.org.apache.xml.internal.serialize,
>> javax.swing,
>> org.apache.commons.collections,
>> org.apache.commons.collections.iterators,
>> org.apache.commons.logging,
>> org.apache.felix.framework,
>> org.apache.felix.framework.cache,
>> org.apache.felix.framework.util,
>> org.apache.felix.main,
>> org.apache.log4j,
>> org.apache.log4j.net,
>> org.apache.xerces.dom,
>> org.osgi.framework,
>> org.osgi.util.tracker,
>> ...
>>
>>
>> So I'm import the package that the second instances of Felix needs to work,
>> and all of these package are exported by the first instance of Felix
>>
>> regards,
>>
>> Andrea
>>
>>
>>
>> Karl Pauls ha scritto:
>>     
>>> What version of felix are you using?
>>>
>>> In case you are not using the current trunk can you try with it first
>>> (there have been some fixes that might be related)...
>>>
>>> Furthermore, are you sure the bundle that embeds felix is not
>>> importing any felix (i.e., org.apache.felix) packages? Can you maybe
>>> show us the manifest of the bundle that embeds felix?
>>>
>>> regards,
>>>
>>> Karl
>>>
>>> On Thu, Aug 27, 2009 at 10:25 AM, Andrea
>>> Turbati<tu...@info.uniroma2.it> wrote:
>>>
>>>       
>>>> Hi,
>>>> I'm trying to lunch a second Felix instance inside a Felix bundle, or to
>>>> be
>>>> more precise the second instance of felix is inside a jar which it's
>>>> inside
>>>> a bundle. So this is the situation:
>>>> I have the main program (MainProgram) which Felix is embedded. This
>>>> MainProgram find and install various bundle and inside one of this
>>>> (ParticularBundle) there are two jars, one (SpecialJar.jar) that starts
>>>> another instance of Felix and another "normal" jar (NormalJar.jar).
>>>> Naturally the Manifest of the ParticularBundle contains the following
>>>> lines:
>>>>
>>>> Bundle-ClassPath: .,
>>>>  lib/SpecialJar.jar,
>>>>  lib/NormalJar.jar
>>>>
>>>> The second instance of Felix seems to start fine, but for some reasons
>>>> it's
>>>> able to export correctly (using Constants.FRAMEWORK_SYSTEMPACKAGES) only
>>>> the
>>>> packages which were imported with the manifest of ParticularBundle. This
>>>> means that in ParticularBundle I can use all the classes that are
>>>> contained
>>>> in the two jars (SpecialJar.jar and NormalJar.jar), but all the bundle
>>>> that
>>>> are discovered and installed by the instance of Felix in SpecialJar.jar
>>>> are
>>>> able to use only the package exported by the first instance of Felix,
>>>> imported by ParticularBundle and then exported by the second instance of
>>>> Felix, but when they try to use a class of a package that belongs to
>>>> SpecialJar.jar or NormalJar.jar and is exported by the second isntance of
>>>> Felix they throw a java.lang.NoClassDefFoundError: my.package.MyClass
>>>> (this
>>>> should mean that the bundle is importing the package and that the socond
>>>> instance of Felix it's exporting it).
>>>>
>>>> I think that it is a classloader problem, but I really don't know how to
>>>> solve it.
>>>>
>>>> Regards,
>>>>
>>>> Andrea Turbati
>>>>
>>>> --
>>>>
>>>> -------------------------------------------------
>>>>
>>>> Dott. Andrea Turbati
>>>>
>>>> AI Research Group PhD student,
>>>>
>>>> Dept. of Computer Science, Systems and Production
>>>>
>>>> University of Roma, Tor Vergata
>>>>
>>>> Via del Politecnico 1 00133 ROMA (ITALY)
>>>>
>>>> tel: +39 06 7259 7332 (lab)
>>>>
>>>> e_mail: turbati@info.uniroma2.it
>>>>
>>>> home page: http://art.uniroma2.it/turbati/
>>>>
>>>> --------------------------------------------------
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>>>>         
>>>
>>>
>>>       
>> --
>>
>> -------------------------------------------------
>>
>> Dott. Andrea Turbati
>>
>> AI Research Group PhD student,
>>
>> Dept. of Computer Science, Systems and Production
>>
>> University of Roma, Tor Vergata
>>
>> Via del Politecnico 1 00133 ROMA (ITALY)
>>
>> tel: +39 06 7259 7332 (lab)
>>
>> e_mail: turbati@info.uniroma2.it
>>
>> home page: http://art.uniroma2.it/turbati/
>>
>> --------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>     
>
>
>
>   


-- 

-------------------------------------------------
 
Dott. Andrea Turbati

AI Research Group PhD student,

Dept. of Computer Science, Systems and Production

University of Roma, Tor Vergata

Via del Politecnico 1 00133 ROMA (ITALY)

tel: +39 06 7259 7332 (lab)

e_mail: turbati@info.uniroma2.it

home page: http://art.uniroma2.it/turbati/

--------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Instance of Felix inside a Felix bundle

Posted by Karl Pauls <ka...@gmail.com>.
Well, there you go then. You are importing the
org.apache.felix.framework.* packages. This way the framework gets
confused and is using the wrong classloader (I'd argue that this is
something we should fix in felix but its more a feature then a bug).

You did say that you embed the felix.jar inside your bundle. If that
is the case then just put it on the bundle classpath and remove the
imports for org.apache.felix.* from the bundle and that should make it
work.

regards,

Karl

On Thu, Aug 27, 2009 at 11:00 AM, Andrea
Turbati<tu...@info.uniroma2.it> wrote:
> I'm using Felix 1.8.0.
>
> The Manifest of the bundle that embeds Felix is
>
>
> Manifest-Version: 1.0
> Bundle-Activator: it.uniroma2.art.stontoling.bundle.STOntoLingBundle
> Bundle-ClassPath: .,
> lib/LinguisticWatermark.jar,
> lib/OntoLing_Core.jar,
> Import-Package:
> com.sun.org.apache.xerces.internal.dom,
> com.sun.org.apache.xml.internal.serialize,
> javax.swing,
> org.apache.commons.collections,
> org.apache.commons.collections.iterators,
> org.apache.commons.logging,
> org.apache.felix.framework,
> org.apache.felix.framework.cache,
> org.apache.felix.framework.util,
> org.apache.felix.main,
> org.apache.log4j,
> org.apache.log4j.net,
> org.apache.xerces.dom,
> org.osgi.framework,
> org.osgi.util.tracker,
> ...
>
>
> So I'm import the package that the second instances of Felix needs to work,
> and all of these package are exported by the first instance of Felix
>
> regards,
>
> Andrea
>
>
>
> Karl Pauls ha scritto:
>>
>> What version of felix are you using?
>>
>> In case you are not using the current trunk can you try with it first
>> (there have been some fixes that might be related)...
>>
>> Furthermore, are you sure the bundle that embeds felix is not
>> importing any felix (i.e., org.apache.felix) packages? Can you maybe
>> show us the manifest of the bundle that embeds felix?
>>
>> regards,
>>
>> Karl
>>
>> On Thu, Aug 27, 2009 at 10:25 AM, Andrea
>> Turbati<tu...@info.uniroma2.it> wrote:
>>
>>>
>>> Hi,
>>> I'm trying to lunch a second Felix instance inside a Felix bundle, or to
>>> be
>>> more precise the second instance of felix is inside a jar which it's
>>> inside
>>> a bundle. So this is the situation:
>>> I have the main program (MainProgram) which Felix is embedded. This
>>> MainProgram find and install various bundle and inside one of this
>>> (ParticularBundle) there are two jars, one (SpecialJar.jar) that starts
>>> another instance of Felix and another "normal" jar (NormalJar.jar).
>>> Naturally the Manifest of the ParticularBundle contains the following
>>> lines:
>>>
>>> Bundle-ClassPath: .,
>>>  lib/SpecialJar.jar,
>>>  lib/NormalJar.jar
>>>
>>> The second instance of Felix seems to start fine, but for some reasons
>>> it's
>>> able to export correctly (using Constants.FRAMEWORK_SYSTEMPACKAGES) only
>>> the
>>> packages which were imported with the manifest of ParticularBundle. This
>>> means that in ParticularBundle I can use all the classes that are
>>> contained
>>> in the two jars (SpecialJar.jar and NormalJar.jar), but all the bundle
>>> that
>>> are discovered and installed by the instance of Felix in SpecialJar.jar
>>> are
>>> able to use only the package exported by the first instance of Felix,
>>> imported by ParticularBundle and then exported by the second instance of
>>> Felix, but when they try to use a class of a package that belongs to
>>> SpecialJar.jar or NormalJar.jar and is exported by the second isntance of
>>> Felix they throw a java.lang.NoClassDefFoundError: my.package.MyClass
>>> (this
>>> should mean that the bundle is importing the package and that the socond
>>> instance of Felix it's exporting it).
>>>
>>> I think that it is a classloader problem, but I really don't know how to
>>> solve it.
>>>
>>> Regards,
>>>
>>> Andrea Turbati
>>>
>>> --
>>>
>>> -------------------------------------------------
>>>
>>> Dott. Andrea Turbati
>>>
>>> AI Research Group PhD student,
>>>
>>> Dept. of Computer Science, Systems and Production
>>>
>>> University of Roma, Tor Vergata
>>>
>>> Via del Politecnico 1 00133 ROMA (ITALY)
>>>
>>> tel: +39 06 7259 7332 (lab)
>>>
>>> e_mail: turbati@info.uniroma2.it
>>>
>>> home page: http://art.uniroma2.it/turbati/
>>>
>>> --------------------------------------------------
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>
>>
>>
>>
>
>
> --
>
> -------------------------------------------------
>
> Dott. Andrea Turbati
>
> AI Research Group PhD student,
>
> Dept. of Computer Science, Systems and Production
>
> University of Roma, Tor Vergata
>
> Via del Politecnico 1 00133 ROMA (ITALY)
>
> tel: +39 06 7259 7332 (lab)
>
> e_mail: turbati@info.uniroma2.it
>
> home page: http://art.uniroma2.it/turbati/
>
> --------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Instance of Felix inside a Felix bundle

Posted by Andrea Turbati <tu...@info.uniroma2.it>.
I'm using Felix 1.8.0.

The Manifest of the bundle that embeds Felix is


Manifest-Version: 1.0
Bundle-Activator: it.uniroma2.art.stontoling.bundle.STOntoLingBundle
Bundle-ClassPath: .,
 lib/LinguisticWatermark.jar,
 lib/OntoLing_Core.jar,
Import-Package:
 com.sun.org.apache.xerces.internal.dom,
 com.sun.org.apache.xml.internal.serialize,
 javax.swing,
 org.apache.commons.collections,
 org.apache.commons.collections.iterators,
 org.apache.commons.logging,
 org.apache.felix.framework,
 org.apache.felix.framework.cache,
 org.apache.felix.framework.util,
 org.apache.felix.main,
 org.apache.log4j,
 org.apache.log4j.net,
 org.apache.xerces.dom,
 org.osgi.framework,
 org.osgi.util.tracker,
 ...
 

So I'm import the package that the second instances of Felix needs to 
work, and all of these package are exported by the first instance of Felix

regards,

Andrea



Karl Pauls ha scritto:
> What version of felix are you using?
>
> In case you are not using the current trunk can you try with it first
> (there have been some fixes that might be related)...
>
> Furthermore, are you sure the bundle that embeds felix is not
> importing any felix (i.e., org.apache.felix) packages? Can you maybe
> show us the manifest of the bundle that embeds felix?
>
> regards,
>
> Karl
>
> On Thu, Aug 27, 2009 at 10:25 AM, Andrea
> Turbati<tu...@info.uniroma2.it> wrote:
>   
>> Hi,
>> I'm trying to lunch a second Felix instance inside a Felix bundle, or to be
>> more precise the second instance of felix is inside a jar which it's inside
>> a bundle. So this is the situation:
>> I have the main program (MainProgram) which Felix is embedded. This
>> MainProgram find and install various bundle and inside one of this
>> (ParticularBundle) there are two jars, one (SpecialJar.jar) that starts
>> another instance of Felix and another "normal" jar (NormalJar.jar).
>> Naturally the Manifest of the ParticularBundle contains the following lines:
>>
>> Bundle-ClassPath: .,
>>  lib/SpecialJar.jar,
>>  lib/NormalJar.jar
>>
>> The second instance of Felix seems to start fine, but for some reasons it's
>> able to export correctly (using Constants.FRAMEWORK_SYSTEMPACKAGES) only the
>> packages which were imported with the manifest of ParticularBundle. This
>> means that in ParticularBundle I can use all the classes that are contained
>> in the two jars (SpecialJar.jar and NormalJar.jar), but all the bundle that
>> are discovered and installed by the instance of Felix in SpecialJar.jar are
>> able to use only the package exported by the first instance of Felix,
>> imported by ParticularBundle and then exported by the second instance of
>> Felix, but when they try to use a class of a package that belongs to
>> SpecialJar.jar or NormalJar.jar and is exported by the second isntance of
>> Felix they throw a java.lang.NoClassDefFoundError: my.package.MyClass (this
>> should mean that the bundle is importing the package and that the socond
>> instance of Felix it's exporting it).
>>
>> I think that it is a classloader problem, but I really don't know how to
>> solve it.
>>
>> Regards,
>>
>> Andrea Turbati
>>
>> --
>>
>> -------------------------------------------------
>>
>> Dott. Andrea Turbati
>>
>> AI Research Group PhD student,
>>
>> Dept. of Computer Science, Systems and Production
>>
>> University of Roma, Tor Vergata
>>
>> Via del Politecnico 1 00133 ROMA (ITALY)
>>
>> tel: +39 06 7259 7332 (lab)
>>
>> e_mail: turbati@info.uniroma2.it
>>
>> home page: http://art.uniroma2.it/turbati/
>>
>> --------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>     
>
>
>
>   


-- 

-------------------------------------------------
 
Dott. Andrea Turbati

AI Research Group PhD student,

Dept. of Computer Science, Systems and Production

University of Roma, Tor Vergata

Via del Politecnico 1 00133 ROMA (ITALY)

tel: +39 06 7259 7332 (lab)

e_mail: turbati@info.uniroma2.it

home page: http://art.uniroma2.it/turbati/

--------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Instance of Felix inside a Felix bundle

Posted by Karl Pauls <ka...@gmail.com>.
What version of felix are you using?

In case you are not using the current trunk can you try with it first
(there have been some fixes that might be related)...

Furthermore, are you sure the bundle that embeds felix is not
importing any felix (i.e., org.apache.felix) packages? Can you maybe
show us the manifest of the bundle that embeds felix?

regards,

Karl

On Thu, Aug 27, 2009 at 10:25 AM, Andrea
Turbati<tu...@info.uniroma2.it> wrote:
> Hi,
> I'm trying to lunch a second Felix instance inside a Felix bundle, or to be
> more precise the second instance of felix is inside a jar which it's inside
> a bundle. So this is the situation:
> I have the main program (MainProgram) which Felix is embedded. This
> MainProgram find and install various bundle and inside one of this
> (ParticularBundle) there are two jars, one (SpecialJar.jar) that starts
> another instance of Felix and another "normal" jar (NormalJar.jar).
> Naturally the Manifest of the ParticularBundle contains the following lines:
>
> Bundle-ClassPath: .,
>  lib/SpecialJar.jar,
>  lib/NormalJar.jar
>
> The second instance of Felix seems to start fine, but for some reasons it's
> able to export correctly (using Constants.FRAMEWORK_SYSTEMPACKAGES) only the
> packages which were imported with the manifest of ParticularBundle. This
> means that in ParticularBundle I can use all the classes that are contained
> in the two jars (SpecialJar.jar and NormalJar.jar), but all the bundle that
> are discovered and installed by the instance of Felix in SpecialJar.jar are
> able to use only the package exported by the first instance of Felix,
> imported by ParticularBundle and then exported by the second instance of
> Felix, but when they try to use a class of a package that belongs to
> SpecialJar.jar or NormalJar.jar and is exported by the second isntance of
> Felix they throw a java.lang.NoClassDefFoundError: my.package.MyClass (this
> should mean that the bundle is importing the package and that the socond
> instance of Felix it's exporting it).
>
> I think that it is a classloader problem, but I really don't know how to
> solve it.
>
> Regards,
>
> Andrea Turbati
>
> --
>
> -------------------------------------------------
>
> Dott. Andrea Turbati
>
> AI Research Group PhD student,
>
> Dept. of Computer Science, Systems and Production
>
> University of Roma, Tor Vergata
>
> Via del Politecnico 1 00133 ROMA (ITALY)
>
> tel: +39 06 7259 7332 (lab)
>
> e_mail: turbati@info.uniroma2.it
>
> home page: http://art.uniroma2.it/turbati/
>
> --------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org