Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 49623 invoked from network); 22 Apr 2005 05:47:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Apr 2005 05:47:52 -0000 Received: (qmail 5185 invoked by uid 500); 22 Apr 2005 05:47:38 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 5161 invoked by uid 500); 22 Apr 2005 05:47:38 -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 5145 invoked by uid 99); 22 Apr 2005 05:47:38 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of alexandre.akoulov@citigroup.com designates 199.67.203.181 as permitted sender) Received: from smtp3.citigroup.com (HELO mail.citigroup.com) (199.67.203.181) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 21 Apr 2005 22:47:37 -0700 Received: from imbarc-ny02.ny.ssmb.com (imbarc-ny02.ny.ssmb.com [162.124.186.139]) by imbaspam-eu04.eur.nsroot.net (8.13.1/8.13.1/SSMB_EXT/ev: 11565 $) with ESMTP id j3M5kuE6003295 for ; Fri, 22 Apr 2005 05:47:11 GMT Received: from mailhub-au01.aus.nsroot.net (mailhub-au01.aus.nsroot.net [169.191.97.43]) by imbarc-ny02.ny.ssmb.com (8.13.1/8.13.1/SSMB_QQQ_IN/1.1) with ESMTP id j3M5kbP3029020 for ; Fri, 22 Apr 2005 05:46:37 GMT Received: from exsysm01.aus.nsroot.net (prkbigip1-11-1-int0.aus.nsroot.net [169.191.97.129]) by mailhub-au01.aus.nsroot.net (8.12.10/8.12.10/CG_HUB) with ESMTP id j3M5kato025027 for ; Fri, 22 Apr 2005 05:46:36 GMT Received: from exsymb02.aus.nsroot.net ([169.191.99.130]) by exsysm01.aus.nsroot.net with Microsoft SMTPSVC(5.0.2195.6713); Fri, 22 Apr 2005 15:46:36 +1000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository Date: Fri, 22 Apr 2005 15:46:35 +1000 Message-ID: <1F78B75C252B574FBC551990AE8A8367023CEC47@exsymb02.aus.nsroot.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository Thread-Index: AcVGTDgaQOh5BfPITDCSQNNgbypw+gAGC2YQABtO6NAACbBMMAAAhMaQ From: "Akoulov, Alexandre [IT]" To: "Tomcat Users List" X-OriginalArrivalTime: 22 Apr 2005 05:46:36.0086 (UTC) FILETIME=[A56BA560:01C546FE] X-Scanned-By: MIMEDefang 2.48 on 169.186.247.39 X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N >The standard catalina.properties already has several jars and several >directories specified for the various class loaders, standard catalina.properties has refs to "*.jar" (eg, = ${catalina.home}/common/endorsed/*.jar) not to the actual jar file.=20 Bootstrap.java then checks whether there is "*.jar" at the end of the = path, strips it from the path and then adds to the packed list. If the = path ends in anything other than "*.jar" it gets added to unpacked list = (that is where the jar file ends up) -------------------------------------------------------------- if (repository.endsWith("*.jar")) { packed =3D true; repository =3D repository.substring (0, repository.length() - "*.jar".length()); } if (packed) { packedList.add(new File(repository)); } else { unpackedList.add(new File(repository)); } -------------------------------------------------------------- However, if you add a reference to the actual jar file (eg, = shared.loader=3D${catalina.home}/shared/lib/velocity-dep-1.3.1.jar) you = will not be able to use any classes from it but rather will get = ClassNotFoundException. This is the actual problem! >Read the javadoc for the class in question. (The full URL is >http://jakarta.apache.org/tomcat/tomcat-5.0-doc/catalina/docs/api/org/ap= >ache/catalina/startup/ClassLoaderFactory.html#createClassLoader(java.io.= >File[],%20java.io.File[],%20java.net.URL[],%20java.lang.ClassLoader).) Well, the java doc says that "packed - Array of pathnames to DIRECTORIES = CONTAINING JAR files that should be added to the repositories of the = class loader, or null for no directories of JAR files to be considered" = (not the actual jar files!!!!).=20 At the same time java doc indicates that "unpacked - Array of pathnames = to unpacked directories that should be added to the repositories of the = class loader, or null for no unpacked directories to be considered". I = guess here it means that a jar file is already considered to be unpacked = directory. This conclusion can be drawn from the Bootstrap.java code = extract (see above) and more importantly from the actual = ClassLoaderFactory#createClassLoader method's source: ------------------------------------------------ if (unpacked !=3D null) { for (int i =3D 0; i < unpacked.length; i++) { File file =3D unpacked[i]; if (!file.exists() || !file.canRead()) continue; if (debug >=3D 1) log(" Including directory or JAR " // LOOK HERE - = expects directory or a JAR file + file.getAbsolutePath()); .............. .............. if (packed !=3D null) { for (int i =3D 0; i < packed.length; i++) { File directory =3D packed[i]; if (!directory.isDirectory() || !directory.exists() || !directory.canRead()) // LOOK HERE - only expects = to find directories in here, not the files!!!!!!!!!!! continue; =20 ------------------------------------------------ -----Original Message----- From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] Sent: Friday, 22 April 2005 3:13 PM To: Tomcat Users List Subject: RE: Problem with the classloader in jakarta-tomcat-5.0.28 - cannot add a jar file to class repository > From: Akoulov, Alexandre [IT] [mailto:alexandre.akoulov@citigroup.com] > Sent: 2005 April 21, Thursday 19:48 > Subject: RE: Problem with the classloader in=20 > jakarta-tomcat-5.0.28 - cannot add a jar file to class repository >=20 > I still think it is a bug!!!=20 Read the javadoc for the class in question. (The full URL is http://jakarta.apache.org/tomcat/tomcat-5.0-doc/catalina/docs/api/org/ap ache/catalina/startup/ClassLoaderFactory.html#createClassLoader(java.io. File[],%20java.io.File[],%20java.net.URL[],%20java.lang.ClassLoader).) The first parameter is for directories, the second for jars, which is why they're named "unpacked" and "packed", respectively. =20 > Please try the following: add a jar file (eg, foo/bar.jar) as=20 > a class repository in the catalina.properties The standard catalina.properties already has several jars and several directories specified for the various class loaders, and they all seem to work fine in the levels I'm using (5.0.28 and 5.5.7) - otherwise Tomcat wouldn't even be able to start up. What specifically did you change in catalina.properties that led you to believe there's a problem? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org