[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [equinox-dev] Recipe to get extension bundle classes on the class path
- From: Simon Kaegi <Simon_Kaegi@xxxxxxxxxx>
- Date: Fri, 8 Jun 2007 23:18:27 -0400
- Delivered-to: email@example.com
If you're writing a custom LogManager I'd definitely suggest placing the
code for your implementation on the classpath. e.g. SystemClassLoader. As I
gather you're aware, the LogManager sets the manager in its static
initializer so I'd suggest avoiding any initialization order dependencies
that count on specific visibility via the context class loader being used
when the class is first loaded. Another good reason to use the
SystemClassLoader over a bundle in this case is that once the LogManager is
set it can't be unloaded (barring Reflection) until the VM is shutdown. In
this case your logging initializer would still have to call
LogManager.readConfiguration(...) to load your settings from the config
That said, if you're in full control of your system and willing to live
with the consequences you should be able to set the LogManager via the
Try creating a regular bundle that contains your LogManager implementation
and in the Activator.start method set the System Properties (if not already
set) and then touch the LogManager class in some way to get it to load and
ContextFinder will load classes from the first bundle on the stack which
should be your bundle that holds the implementation so it should just work.
If it doesn't I suspect that you'll have to carefully debug/walk the
LogManager static initializer to see what's going on.
Do either of these approaches work for you? Am I missing something?
equinox-dev-bounces@xxxxxxxxxxx wrote on 06/04/2007 02:23:10 PM:
> I'm still struggling with the extension bundle and class path problems
> I wrote about a couple of weeks ago:
> System and context class loaders
> My goal is to take some classes that I have packaged in a framework
> extension bundle and make them visible to a Java library that searches
> for classes both in the System Class Loader and the Thread Context
> Class Loader -- the java.util.logging library being my first example.
> According to Section 3.15.1 ("Illegal Manifest Headers for Extension
> Bundles") of the OSGi Core R4 specification, classes exported from a
> framework extension bundle must be exported by the System Bundle:
> ,----[ Section 3.15.1 ]
> | Both boot class path and framework extension bundles are permitted to
> | specify an Export-Package header. Any exported packages specified by a
> | framework extension bundle must be exported by the System Bundle when
> | the extension bundle is resolved.
> How does being "exported by the System Bundle" relate to which classes
> are visible to bundles that use ClassLoader.getSystemClassLoader() or
> As the four articles mentioned above show, I'm in need of some recipe
> to coordinate all of these class loading options. Please advise.
> Steven E. Harris
> equinox-dev mailing list