Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 21518 invoked from network); 11 Apr 2003 11:21:19 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 11 Apr 2003 11:21:19 -0000 Received: (qmail 1061 invoked by uid 97); 11 Apr 2003 11:23:09 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@nagoya.betaversion.org Received: (qmail 1052 invoked from network); 11 Apr 2003 11:23:09 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 11 Apr 2003 11:23:09 -0000 Received: (qmail 20104 invoked by uid 500); 11 Apr 2003 11:21:05 -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 20091 invoked from network); 11 Apr 2003 11:21:05 -0000 Received: from dns.centrosistemi.it (HELO ntweb.centrosistemi.it) (195.31.151.34) by daedalus.apache.org with SMTP; 11 Apr 2003 11:21:05 -0000 Received: from romei (192.168.0.85 [192.168.0.85]) by ntweb.centrosistemi.it with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id GZ4H1WLQ; Fri, 11 Apr 2003 13:21:00 +0200 Message-ID: <004b01c3001c$c144ed30$5500a8c0@romei> From: "Alberto Romei" To: Subject: Custom ClassLoader Date: Fri, 11 Apr 2003 13:23:15 +0200 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 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 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 ! I need to tell tomcat to use a custom implementation of ClassLoader for a specific context. The documentation explains the use of inside the element, but I saw that the "loaderClass" attribute is ignored (bug #12501). The only way I found is to create a subclass of WebappLoader and specify it in , tweaking the getClassLoader() method. Here is the code of my experiment : = = = = = = = = = = package prova; import java.io.*; import java.net.*; import org.apache.catalina.loader.WebappLoader; import org.apache.catalina.loader.WebappClassLoader; public class MyLoader extends WebappLoader { static { System.out.println("*****************Here I am*******************"); } ClassLoader cl; public MyLoader() { super(); } public MyLoader(java.lang.ClassLoader parent) { super(parent); } public ClassLoader getClassLoader() { if (cl==null) { URLClassLoader push = (URLClassLoader)super.getClassLoader(); cl = new URLClassLoader(push.getURLs(), push) { public String toString() { String rv = "***** Prova *****\r\n"; URL arr[] = ((WebappClassLoader)this.getParent()).getURLs(); for (int i=0; i