Hello,

The following summary describes how I was able to launch Felix from within a
bundle using bndtools:

1. Embed the framework.jar inside the bundle that will launch the "inner"
framework.
2. With bndtools, there are two ways to embed a jar file in a bundle i)
"Rolled" and ii) "Unrolled" e.g. bnd.bnd file
    i) Include-Resource: lib/org.apache.felix.framework-3.2.2.jar     =>
Rolled
   ii) Include-Resource: @lib/org.apache.felix.framework-3.2.2.jar  =>
Unrolled - expands the Felix jar

These two options produce two different MANIFEST.MF files and both require
tweaking to get it to work.

The framework.jar must also be in the project's Build Path.

3. With option i) I had to "Customize Imports" with bndtools as follows:
    !org.apache.felix.framework

which produced the following:
  Ignore-Package: org.apache.felix.framework
  Import-Package: org.osgi.framework;version="[1.5,2)",org.osgi.framework.
  launch;version="[1.0,2)",org.me.spi;version=" [1.0,2)"

I also had to add Bundle-Classpath: .,org.apache.felix.framework-3.2.2.jar
to the bnd.bnd file

4) With option ii) I had to "Customize Imports" with bndtools as follows:
    !dalvik.system
    !android.dalvik
    org.osgi.framework

which produced the following:
  Ignore-Package: dalvik.system,android.dalvik
  Import-Package: javax.security.auth.x500,org.osgi.framework;version="[1.
  5,2)",org.me.spi;version="[1.0,2)"

I had to "ignore" the dalvik stuff because I wasn't making use of it and
therefore getting "Unresolved constraints" exception.

What wasn't apparent to me at first is that package org.osgi.framework must
be in the Import-Package header, this is because my activator (which
implements org.osgi.framework.BundleActivator) must NOT get loaded from the
embedded framework otherwise a ClassCastException is thrown which is due to
the org.osgi.framework.BundleActivator interface loading from the incorrect
class space.

Thanks to Richard Hall, Karl Pauls and Peter Kriens for all the help and
getting me hooked on OSGi :drunk:

Regards
Jorge

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

-- 
View this message in context: 
http://old.nabble.com/launch-framework-from-bundle-tp32155585p32282032.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to