To reproduce the problem, on a Windows machine, create a test.jar, and run the following test case in jdb. Stop at the first println, "test.jar" is now locked and cannot be deleted.
Note that the test is only trying to get a non-existant resource. Note also that this is only a problem for the Windows platform.
This bug breaks an important functionality in AppServer, because it makes undeployment of a web applications impossible (in Windows), because jar files in it cannot be deleted. See bug 5004315. There does not seems to be any workarounds.
% cat Test.java
import java.io.*;
import java.net.*;
class Test {
public static void main(String args[]) {
try {
File jarf = (new File("test.jar")).getCanonicalFile();
URL urls[] = { jarf.toURL() };
URLClassLoader loader =
new URLClassLoader(urls, Test.class.getClassLoader());
InputStream is = loader.getResourceAsStream("BadName");
System.out.println("stream is " + is);
} catch (Exception ex) {
System.out.println("Error: " + ex);
}
}
}
###@###.### 2004-04-30
Note that the test is only trying to get a non-existant resource. Note also that this is only a problem for the Windows platform.
This bug breaks an important functionality in AppServer, because it makes undeployment of a web applications impossible (in Windows), because jar files in it cannot be deleted. See bug 5004315. There does not seems to be any workarounds.
% cat Test.java
import java.io.*;
import java.net.*;
class Test {
public static void main(String args[]) {
try {
File jarf = (new File("test.jar")).getCanonicalFile();
URL urls[] = { jarf.toURL() };
URLClassLoader loader =
new URLClassLoader(urls, Test.class.getClassLoader());
InputStream is = loader.getResourceAsStream("BadName");
System.out.println("stream is " + is);
} catch (Exception ex) {
System.out.println("Error: " + ex);
}
}
}
###@###.### 2004-04-30
- relates to
-
JDK-5098318 Cached Jar file should be released on appl. exit even that is opended by Cipher
-
- Resolved
-
-
JDK-6587593 (sl) Service provider lookup causes JAR files to be locked on Windows
-
- Closed
-
-
JDK-6207022 JarURLConnection throws FileNotFoundException in Linux when jar is modified
-
- Closed
-