users@glassfish.java.net

Re: Exposing jaxws classes when classloader delegate is set to false

From: <glassfish_at_javadesktop.org>
Date: Wed, 24 Mar 2010 16:36:42 PDT

As it turns out the jaxws classes are actually accessible. But they don't show up when one calls WebAppClassLoader#getResources("com/sun"). I'm not sure if this is by design or if it is a bug.

The app I'm deploying to gf is Confluence, which is self an osgi host with its plugins installed as osgi bundles (within its own instance of felix).

So the simplified classloader hierarchy looks something like this:
system classloader -> gf system bundle + other bundles (including metro) -> confluence system bundle + plugin bundles.

Confluence uses pkgscanner[1] to scan its main classloader (gf's webappclassloader) for available packages which are then exposed to its plugins. Because the jaxws packages are not found by this scanner, they are not exposed to confluence plugins and that's why I get NoClassDefError.

If I override pkgscanner and add jaxws to its list of found packages all these classes are found.

This[2] is the exact line in pkg scanner that retrieves the list of packages from the classloader. The class loader on that line is gf's WebAppClassLoader and packageName is "com" and "com/sun". Is this a proper way to look for packages (in which case, the GF's webappclassloader is at fault), or should it be done differently?

[1] http://code.google.com/p/pkgscanner/
[2] http://code.google.com/p/pkgscanner/source/browse/trunk/src/main/java/org/twdata/pkgscanner/InternalScanner.java#87
[Message sent by forum member 'iminar']

http://forums.java.net/jive/thread.jspa?messageID=393595