Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 26747 invoked from network); 7 May 2002 06:27:35 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 7 May 2002 06:27:35 -0000 Received: (qmail 9229 invoked by uid 97); 7 May 2002 06:27:28 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 9176 invoked by uid 97); 7 May 2002 06:27:28 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 9162 invoked by uid 98); 7 May 2002 06:27:27 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <000901c1f58f$ea38bd40$fec2f80c@abner> From: "Tony LaPaso" To: Subject: ?? Class Loaders, Static Initializers, Open Files ?? Date: Tue, 7 May 2002 01:24:59 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi all, This is a core Java language issue but its roots are in servlets. I have a servlet (running on Tomcat v4.0.3), MyServlet, which calls Class.forName("XXX") in it's init() method. Now class XXX has a static initializer that opens a file for output and keeps it open. Later, I change the code in MyServlet and recompile it. The Tomcat notices the change and automatically loads the new version of MyServlet, using a different class loader than was used for the previous version. But when the new version of MyServlet calls Class.forName("XXX"), the static initializer in XXX cannot open the file because the previous version has it open. So even though the first class loader is being "dropped/abandoned", there is still a class loaded by that class loader (class XXX) that has a file open. And of course, I do not have the code for XXX. Is there any way to specify, either to the JVM or to Tomcat, that the file opened by XXX's static initializer should be closed? I'm guessing this is "just the way it works". The previous class loader will be GCed, as will the previous version of MyServlet, but the file opened by XXX stays open until the VM goes down... Thanks... -- To unsubscribe, e-mail: For additional commands, e-mail: