> > I just started with OSGi/Felix and went through a lot of reading over the
> weekend regarding classloading/osgi/felix. I still don't have a clear idea of
> how to incorporate an external library into my app.
> >
> > I understand that OSGi do class loading through Import-Package, no
> > more linear class loading like in an traditional Java app. That means
> > if a bundle does not specify what packages it want to import, it will
> > not be available to that bundle. On the other hand, everything on
> > classpath, if specified by Import-Package, will be available to a
> > bundle. (did I get that right?)
> >
>
> A bundle can only see stuff it imports as long as there is someone else
> exporting it. For class path packages, the system bundle (i.e., the
> framework) will export everything in the JRE by default. If you have some
> other non-JRE packages on the class path that you want bundles to be able to
> import, then you must add them to the
> org.osgi.framework.system.packages.extra property in the
> conf/config.properties file.
>

Thanks for the quick reply.

It took me couple tries but eventually got it right.  I used log4j as a test and
added It to the org.osgi.framework.system.packages.extra property as well as
the bundle manifest to get it going.

But I didn't quite understand the difference between
org.osgi.framework.system.packages.extra and org.osgi.framework.bootdelegation.
Do bundles get to see all package exported by either properties?

> > The ultimate goal here is to reuse felix.jar as a host and import a 3rd 
> > party
> jar so that one of the bundle can use it. (is this even the right approach?)
> What's the best way to do this?
> >
>
> The best approach is to create a bundle out of the third-party JAR file and
> install it into the framework along with your bundle. If this isn't possible 
> (or
> desired), then you can add it to the class path and export it from the system
> bundle as described above.
>

Exporting 3rd party jar in config.properties isn't an ideal solution since it
breaks modularity and I won't be able to use OSGi's facility to resolve 
dependencies.
Wouldn't it be nice if I can just build a bundle for a closed-source 3rd party 
jar.

Or open-source everything.

it's a good day for day dreaming

:)

kel

NOTICE: This communication is intended only for the use of the person or entity 
named above and may contain information that is confidential or legally 
privileged. If you are not the intended recipient named above or a person 
responsible for delivering messages or communication to the intended recipient, 
you are hereby notified that any use, distribution, or copying of this 
communication or any of the information contained in it is strictly prohibited. 
If you have this communication in error, please notify me immediately by 
telephone and then destroy or delete this communication, or return it to me by 
mail if requested. Thank you for your attention and cooperation.

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

Reply via email to