Bug 33830 - Tomcat 5.5 series fails to undeploy apps with jar resources
Summary: Tomcat 5.5 series fails to undeploy apps with jar resources
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Webapps:Manager (show other bugs)
Version: 5.5.7
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-03 10:55 UTC by Ilkka Priha
Modified: 2005-03-03 02:07 UTC (History)
0 users



Attachments
The hello world sample with added jar resource access (2.64 KB, text/plain)
2005-03-03 10:58 UTC, Ilkka Priha
Details
The resources for the hello world sample (1.92 KB, text/plain)
2005-03-03 11:01 UTC, Ilkka Priha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ilkka Priha 2005-03-03 10:55:55 UTC
If a web app has other resources than classes in jar archives and accesses them
through the context class loader, the undeployment of such web apps fails
because the corresponding jar archives are not deleted. This happens in at least
5.5.6, 5.5.7 and 5.5.8a.

The same problem is present in 4.1 series but not in 5.0 series.

The following code snippet shows a simple test case:

        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        URL url1 = loader.getResource("LocalStrings.properties");
        InputStream in = url1.openStream();
        int b = in.read();
        in.close();
Comment 1 Ilkka Priha 2005-03-03 10:58:57 UTC
Created attachment 14395 [details]
The hello world sample with added jar resource access

The attached servlet must be packed into a jar together with the
LocalStrings.properties resource file to repeat the problem.
Comment 2 Ilkka Priha 2005-03-03 11:01:03 UTC
Created attachment 14396 [details]
The resources for the hello world sample

The resources must be packed into a jar together with the HelloWorldExample
servlet to reproduce the problem.
Comment 3 Remy Maucherat 2005-03-03 11:07:04 UTC
There's a FAQ chapter on Windows. You should read it (and, more generally, post
to tomcat-user for this kind of issue).

If you want to avoid locking, you can also use getResourceAsStream, or learn to
open your URLs cleanly after using setUseCaches(false).