You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Richard Frazer <Ri...@haht.com> on 2002/07/24 18:17:44 UTC

Help please: DirContextURLStreamHandler/Jasper question and possi ble bug...

I'm running with Tomcat 4.1 and am seeing the following problem (and have
actually been seeing the problem since 4.0.4):

Jasper relies on the fact that the DirContext is bound in
DirContextURLStreamHandler based on the app classloader.  This is bound when
the StandardContext is started, stopped, or reloaded.  The code in Jasper
that relies on it is the TagLibraryInfoImpl class.  It uses a
JarURLConnection which in turn uses DirContextURLStreamHandler to lookup the
DirContext based on Thread.currentThread().getContextClassloader().

This all works fine as long as the DirContext stays bound to the
DirContextURLStreamHandler for the lifetime of the application. However, the
DirContext gets unbound if another app is started later on on the same
thread as the first app.  If you look in StandardContext.start(), the code
looks like this:

                // Binding thread
                oldCCL = bindThread();
			.
			.
			.
                unbindThread(oldCCL);

The unbindThread method unbinds the DirContext from the
DirContextURLStreamHandler.  Why would the StandardContext.start() method
unbind a classloader from DirContextURLStreamHandler when it doesn't even
know whether it's still in use?

I'm by no means an expert here, so there may be something fairly obvious
that I'm missing.  Please help.

Thanks,
Richard