Hello,
Currently, OJB loads the OJB.properties file by getting an input stream from the corresponding URL. However, if the properties file is embedded in a jar archive, this method locks the corresponding jar and prevents it from being removed during undeployment of a web application (at least in Sun jdk under Windows). Some web containers (e.g. Tomcat) have non-standard configuration options to handle jar resources in a specific way to prevent locking, but a more general solution is to disable caching in the URL connection before opening the input stream. The corresponding patch is attached below.
Another solution would be to apply the ClassLoader.getResourceAsStream() method instead of the ClassLoader.getResource() method currently provided by ClassHelper. This would allow the class loader to provide a non-locking stream.
LoggingConfiguration applies the latter by getting the class loader from ClassHelper and calling directly its getResourceAsStream() method.
-- Ilkka
RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/util/configuration/impl/Attic/ConfigurationAbstractImpl.java,v
retrieving revision 1.15
diff -u -r1.15 ConfigurationAbstractImpl.java
--- ConfigurationAbstractImpl.java 16 Jun 2004 20:34:22 -0000 1.15
+++ ConfigurationAbstractImpl.java 4 Mar 2005 07:16:45 -0000
@@ -25,6 +25,7 @@
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URL;
+import java.net.URLConnection;
import java.util.Properties;
import java.util.StringTokenizer;
@@ -426,7 +427,10 @@
logger.info("Loading OJB's properties from file " + url);
- InputStream strIn = url.openStream(); + URLConnection conn = url.openConnection(); + conn.setUseCaches(false); + conn.connect(); + InputStream strIn = conn.getInputStream();
properties.load(strIn); strIn.close();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]