tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@binarix.com>
Subject Re: Weird Classloaders
Date Sat, 15 Sep 2001 04:01:06 GMT
Remy Maucherat wrote:

> > My environment is JDK 1.3.1_01, Linux. In some other discussions, people
> > from TC 4 team mentioned that there are similar problems on Windows too.
> 
> TC 4 uses a 100% custom URLClassLoader clone, and it accesses the JARs
> directly (using JarFile objects). I'm really careful about properly closing
> these objects when the CL is dumped when reloading. However, there are still
> problems, at least under Windows (the symptoms are roughly what you
> describe). So it looks like the problems are with the java.util.jar package.
> 
> > And finally, do we just write a replacement for this (probably buggy)
> > method, or is there are known workaround or fix for this?
> 
> Nope :(
> 
> Remy

Just found this by searching the web (it's from TC 4 B5 release notes):

-------------------------------------------------------------
If you attempt to undeploy, then redeploy, an application from the same
web application archive file URL (where the URL refers to an actual WAR
file, not to a directory), the redeploy will fail with error "zip file
is
closed".  There appears to be a problem in the JDK's JarURLConnection
class
where JAR files are cached, even after they are closed, so that a
request
for a connection to the same URL returns the previous JarFile object
instead
of a new one.  As a workaround, you should do one of the following:
* Change the URL of the web application archive each time you redeploy.
* Deploy from an unpacked directory (on the same server) instead of from
a WAR file (this is often more convenient in a development environment
anyway).
-------------------------------------------------------------

Can this be related? I've noticed you use those inside the classloaders.
Is there another way to get to those files packed inside jars?

Now if FactoryURLClassLoader uses the above, I wonder if that's causing
such strange behaviour. There is a SimpleClassLoader in TC 3.3 which
kind of does everything by itself (for JDK 1.1 compatibility), but I was
still unable to figure out how to 'turn it on' in Java 2. It would be
interesting to see if that one suffers from the same problems. Any
suggestions from TC 3.3 experts more then welcome...

I checked IBM JDK for Linux. No difference (not surprising given that
both Sun and IBM build from the same source).

Bojan

Mime
View raw message