If the new code could cache the results.. that would be good to. In some profiling, getting the DTM Manager was showing up as a performance hotspot since it was scanning the jars.
-- bk >> -----Original Message----- >> From: Ushakov, Sergey N [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, June 05, 2002 1:45 AM >> To: [EMAIL PROTECTED] >> Cc: Myriam Midy/CAM/Lotus; Gary L Peskin; 'Bryan Kearney' >> Subject: Re: New Xalan not playing well with Tomcat 4.0? >> >> >> [Moved from "xalan-j-users"] >> >> Myriam, >> >> I have scanned the Xalan sources regarding context class >> loaders usage, and >> got some impression that I'd like to share. >> >> There is about dozen pieces of code in different classes and >> packages that >> deal with class loaders, some of them using reflection. They >> are typically >> static private. The only exception is >> org.apache.xpath.functions.loadPropertyFile() which is >> public but not static >> :) >> >> I do not dare to convince anyone, but isn't it a good point >> to have all this >> consolidated in one utility function? Maybe somewhere in >> org.apache.xml.utils? Something like "public static InputStream >> getResourceAsStream(Class c, String name)" ? >> >> Regards, >> Sergey >> >> ----- Original Message ----- >> From: "Myriam Midy/CAM/Lotus" <[EMAIL PROTECTED]> >> To: "Gary L Peskin" <[EMAIL PROTECTED]> >> Cc: "'Bryan Kearney'" <[EMAIL PROTECTED]>; >> <[EMAIL PROTECTED]>; "'Ushakov, >> Sergey N'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >> Sent: Tuesday, June 04, 2002 7:02 PM >> Subject: RE: New Xalan not playing well with Tomcat 4.0? >> >> >> > >> > Will do... >> > >> > >> > Myriam >> > >> > >> > >> > >> > "Gary L Peskin" >> > <[EMAIL PROTECTED] To: >> "'Ushakov, Sergey >> N'" >> > om> >> <[EMAIL PROTECTED]>, >> > >> <[EMAIL PROTECTED]> >> > 06/03/02 09:34 AM cc: >> "'Bryan Kearney'" >> > >> <[EMAIL PROTECTED]>, >> > >> <[EMAIL PROTECTED]>, (bcc: >> Myriam >> > Midy/Cambridge/IBM) >> > Subject: >> RE: New Xalan not >> playing well >> > with Tomcat 4.0? >> > >> > >> > >> > >> > >> > Miriam -- >> > >> > A problem here (which is still here) is that the classloader being >> > obtained is the one used to load the Encodings class and not the >> > ContextClassLoader. Unfortunately, I'm travelling and >> don't have time >> > to clean this up. Can you or Joe take care of it? >> > >> > Gary >> > >> > > -----Original Message----- >> > > From: Ushakov, Sergey N [mailto:[EMAIL PROTECTED] >> > > Sent: Monday, June 03, 2002 2:15 AM >> > > To: [EMAIL PROTECTED] >> > > Cc: Bryan Kearney; 'Gary L Peskin'; [EMAIL PROTECTED] >> > > Subject: Re: New Xalan not playing well with Tomcat 4.0? >> > > >> > > >> > > Colleagues, please have a look at a new version of _encodings >> > > initialization >> > > procedure. Hope it is better... At least it works for me :) >> > > In Tomcat >> > > also... >> > > >> > > 2 Miriam: is it correct to involve you back? >> > > >> > > Regards, Sergey >> > > >> > > P.S. Maybe better move to "xalan-dev" ? >> > > >> > > >> > > ----- Original Message ----- >> > > From: "Ushakov, Sergey N" <[EMAIL PROTECTED]> >> > > To: <[EMAIL PROTECTED]> >> > > Cc: "Bryan Kearney" <[EMAIL PROTECTED]>; "'Gary L Peskin'" >> > > <[EMAIL PROTECTED]> >> > > Sent: Monday, June 03, 2002 2:23 AM >> > > Subject: Re: New Xalan not playing well with Tomcat 4.0? >> > > >> > > >> > > > Bryan, I feel somewhat guilty as I am somehow related >> to this new >> > > > piece of code... :) >> > > > >> > > > I agree with Gary that using class loaders might be >> > > programmed better, >> > > > but >> > > I >> > > > still do not feel I understand it entirely... >> > > > >> > > > I have tried to investigate your issue, but unfortunately I >> > > could not >> > > > reproduce it. That is, I use Tomcat 4.0.4b2 and JDK 1.4.0 >> > > on Windows, >> > > > and have all my encoding issues resolved, and do not get >> > > any NPEs... >> > > > But I >> > > agree >> > > > that if it throws an exception for you then it >> definitely has a bug >> > > > that should be fixed. >> > > > >> > > > Could you describe your configuration that results in NPE? >> > > OS, Tomcat >> > > > version, JDK/JRE version, placement of Xalan, >> environment settings, >> > > > etc... >> > > ? >> > > > >> > > > Regards, >> > > > Sergey >> > > > >> > > > >> > > > ----- Original Message ----- >> > > > From: "Bryan Kearney" <[EMAIL PROTECTED]> >> > > > To: "'Gary L Peskin'" <[EMAIL PROTECTED]>; "Bryan Kearney" >> > > > <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >> > > > Sent: Friday, May 31, 2002 7:02 PM >> > > > Subject: RE: New Xalan not playing well with Tomcat 4.0? >> > > > >> > > > >> > > > > I threw away my output, but I modified the file as shown. >> > > What I saw >> > > > > as output was (See the System.outs) >> > > > > >> > > > > "ST" was blank >> > > > > "BK" showed a tomcat WebAppClass loader which pointed to the >> > > > WEB-INF\classes >> > > > > directory as it should. It delegeted up several layers as >> > > is typical >> > > > > for tomcat. "B" was null >> > > > > "C" was null >> > > > > >> > > > > by moving the location of the file, it was found. TO be >> > > fair.. I do >> > > > > not recall if it ws "B" or "C" that found it however. >> > > > > >> > > > > -- bk >> > > > > >> > > > > >> > > > > private static EncodingInfo[] loadEncodingInfo() >> > > > > { >> > > > > URL url = null; >> > > > > try { >> > > > > String urlString = >> > > > > >> > > System.getProperty("org.apache.xalan.serialize.encodings", ""); >> > > > > System.out.println("ST" + urlString) ; >> > > > > if (urlString == null || urlString.length() == 0) { >> > > > > ClassLoader cl = Encodings.class.getClassLoader(); >> > > > > System.out.println("org/apache/xalan/serialize/" + >> > > > > >> ENCODINGS_FILE) ; >> > > > > System.out.println("BK" + cl) ; >> > > > > >> > > > > if (cl == null) { >> > > > > url = >> > > > ClassLoader.getSystemResource("org/apache/xalan/serialize/" >> > > > > + >> > > > > >> ENCODINGS_FILE); >> > > > > System.out.println("A" + url) ; >> > > > > >> > > > > } else { >> > > > > url = cl.getResource(ENCODINGS_FILE); >> > > > > System.out.println("B" + url) ; >> > > > > if (url == null) >> > > > > url = >> > > > > ClassLoader.getSystemResource("org/apache/xalan/serialize/" + >> > > > > >> ENCODINGS_FILE); >> > > > > System.out.println("C" + url) ; >> > > > > >> > > > > } >> > > > > } else { >> > > > > url = new URL (urlString); >> > > > > System.out.println("D" + url) ; >> > > > > >> > > > > } >> > > > > >> > > > > // ? consider whether we should allow an >> exception here if >> > > resource >> > > > > // is not found or should we return an empty array ? >> > > > > InputStream is = url.openStream(); >> > > > > >> > > > > >> -----Original Message----- >> > > > > >> From: Gary L Peskin [mailto:[EMAIL PROTECTED] >> > > > > >> Sent: Friday, May 31, 2002 8:56 AM >> > > > > >> To: 'Bryan Kearney'; [EMAIL PROTECTED] >> > > > > >> Subject: RE: New Xalan not playing well with Tomcat 4.0? >> > > > > >> >> > > > > >> >> > > > > >> This looks like a bug in Encodings. It seems to >> be using the >> > > > > >> classloader that loaded the Encodings class >> rather than the >> > > > > >> Context classloader. Also, if a classloader is found, >> > > only the >> > > > > >> Encodings.properties name is searched rather than the >> > > full path >> > > > > >> name. There are several problems with this code. >> Could you >> > > > > >> please open a Bugzilla entry on this problem? >> > > > > >> >> > > > > >> Thanks, >> > > > > >> Gary >> > > > > >> >> > > > > >> > -----Original Message----- >> > > > > >> > From: Bryan Kearney [mailto:[EMAIL PROTECTED] >> > > > > >> > Sent: Friday, May 31, 2002 7:47 AM >> > > > > >> > To: 'Gary L Peskin'; Bryan Kearney >> > > > > >> > Subject: RE: New Xalan not playing well with Tomcat 4.0? >> > > > > >> > >> > > > > >> > >> > > > > >> > It was a Null Pointer exception. The url on line 357 >> > > was null. >> > > > > >> > The ClassLoader was unable to find the >> Encodings.properties >> > > > > >> > file if it existed in an un-jarred xalan >> > > installation. I moved >> > > > > >> > it to tomcat/classes (just the >> > > > > >> > Encodings.properties) and the class loader can find >> > > it now. I >> > > > > >> > did not dig to far into the why of it was not >> found as the >> > > > > >> > webapps stuff is already pretty ugly for me. >> > > > > >> > >> > > > > >> > -- bk >> > > > > >> > >> > > > > >> > >> > > > > >> > >> -----Original Message----- >> > > > > >> > >> From: Gary L Peskin [mailto:[EMAIL PROTECTED] >> > > > > >> > >> Sent: Friday, May 31, 2002 8:43 AM >> > > > > >> > >> To: 'Bryan Kearney' >> > > > > >> > >> Subject: RE: New Xalan not playing well with >> Tomcat 4.0? >> > > > > >> > >> >> > > > > >> > >> >> > > > > >> > >> Bryan -- >> > > > > >> > >> >> > > > > >> > >> What is the exception that you're getting at the >> > > top of the >> > > > > >> > >> stack trace? >> > > > > >> > >> >> > > > > >> > >> Gary >> > > > > >> > >> >> > > > > >> > >> > -----Original Message----- >> > > > > >> > >> > From: Bryan Kearney [mailto:[EMAIL PROTECTED] >> > > > > >> > >> > Sent: Friday, May 31, 2002 6:13 AM >> > > > > >> > >> > To: '[EMAIL PROTECTED]' >> > > > > >> > >> > Subject: New Xalan not playing well with >> Tomcat 4.0? >> > > > > >> > >> > >> > > > > >> > >> > >> > > > > >> > >> > Has anyone seen this? I have started to get the >> > > following >> > > > > >> > >> > exception when loading up the encodings: >> > > > > >> > >> > >> > > > > >> > >> > at >> > > > > >> > >> > >> > > org.apache.xalan.serialize.Encodings.loadEncodingInfo(Enco >> > > > > >> > >> > ding >> > > > > >> > >> > s.java:357) >> > > > > >> > >> > at >> > > > > >> > >> >> > > > > >> >> > > org.apache.xalan.serialize.Encodings.<clinit>(Encodings.java:396) >> > > > > >> > >> > at >> > > > > >> >> org.apache.xalan.serialize.SerializerToXML.<init>(SerializerTo >> > > > > >> > >> > XML.java:313) >> > > > > >> > >> > at >> > > > > >> > >> > >> > > org.apache.xalan.serialize.SerializerToHTML.<init>(Seriali >> > > > > >> > >> > zerT >> > > > > >> > >> > oHTML.java:523 >> > > > > >> > >> > ) >> > > > > >> > >> > >> > > > > >> > >> > I am running a pretty new xalan in the latest >> > > tomcat. I do >> > > > > >> > >> > not get this from the command line. Could this >> > > be an issue >> > > > > >> > >> > with tomcats layered clss loades? >> > > > > >> > >> > >> > > > > >> > >> > >> > > > > >> > >> > -- bk >> > > > > >> > >> > >> > > > > >> > >> >> > > > > >> > >> > > > > >> >> > > > > >> > > > >> > > > >> > > >> > >> > >> > >> > >> > >> > >> > >>
