On 3/25/03 08:55 PM [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

> I assume you mean Thread.currentThread().getContextClassLoader().  That's
> *supposed* to work for this purpose, but it's not hard to believe that there
> are problems between vendors.  What would happen if your application code
> set the thread's contextclassloader to be your servlet context class loader?
> This is what your application server vendor is supposed to have done, but if
> it isn't so, can you ...correct the problem?
> 
> I should also mention that I noticed that commons-discovery contains support
> for passing in an object whose class' loader will be used as the basis of
> the search.  That might a useful way to make the behavior more
> deterministic.


(Yes, I was talking about Thread.currentThread().getContextClassLoader(),
looks like I get used to have the editor fix my syntax errors ;).


I don't know what commons discovery is doing, all I can say is that for
instance

 ClassLoader clzLoader = WSDDProvider.class.getClassLoader();
 ClassLoaders loaders = new ClassLoaders();
 loaders.put(clzLoader);
 DiscoverServiceNames dsn = new DiscoverServiceNames(loaders);
 ResourceNameIterator iter =
dsn.findResourceNames(PLUGABLE_PROVIDER_FILENAME);

does not work as expected (see WSDDProvider.java). Using an EAR Bea was
unable to find a resource (I put it in lib/some.jar and
classes/META-INF/..).

The reason is simple in my case: Bea uses an EJB Classloader to load a war
archive, and I have a common shared jar referenced from the ejb-jar and the
war archive in their Manifest.MF. A patched Axis Servlet is part of this
common jar, and thus said it will be loaded through the ejb classloader
directly. You might argue that I could split my jars easily. But this isn't
going to work. Build management for reusable j2ee components is a nightmare,
and the best way to resolve dependencies is using shared jars across
deployed war and ejb jar files ;)


Setting a context classloader could be a bad idea, it could really break the
app server, its thread pools and its resource access. It seems Axis already
does something like that, see "AXIS classloaders breaking J2EE application
isolation" on axis-user. I will try dig into that this evening ...

Jens



Reply via email to