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();
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.
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.
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).