Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 21103 invoked from network); 4 Feb 2003 17:07:36 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 4 Feb 2003 17:07:36 -0000 Received: (qmail 41133 invoked by uid 1059); 4 Feb 2003 17:07:33 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 4 Feb 2003 17:07:33 -0000 Date: Tue, 4 Feb 2003 09:07:32 -0800 (PST) From: "Craig R. McClanahan" To: Jakarta Commons Users List Subject: RE: Digester + Logging + Ant NullPointerException In-Reply-To: <000401c2cc59$7fb94880$6501a8c0@xRemedy> Message-ID: <20030204090448.R38017@icarus.apache.org> References: <000401c2cc59$7fb94880$6501a8c0@xRemedy> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Tue, 4 Feb 2003, Kevin Ross wrote: > Date: Tue, 4 Feb 2003 08:27:06 -0600 > From: Kevin Ross > Reply-To: Jakarta Commons Users List > To: 'Jakarta Commons Users List' > Subject: RE: Digester + Logging + Ant NullPointerException > > Ahh, I see. I haven't touched any of the properties...though ANT > 1.5.1(latest release) may alter the default environment. > > Following is a sample ant target: > > > newenvironment="true"> > value="-Djava.endorsed.dirs=${dir.lib}"/> > > > > > > Is this potentially an issue related to jdk 1.4+? > Is digester in your "${dir.lib}" directory? If so, that's likely to be the root of the problem, and/or will cause you other class loading issues, because it changes the class loader hierarchy in ways that are quite surprising to newbies. I strongly suggest that you don't use the endorsed directory mechanism at all. Instead, use Ant's nested element to construct the class path for a given program, and pass everything in that classpath. Craig > -Kevin > > -----Original Message----- > From: Craig R. McClanahan [mailto:craigmcc@apache.org] > Sent: Monday, February 03, 2003 9:29 PM > To: Jakarta Commons Users List > Subject: RE: Digester + Logging + Ant NullPointerException > > > > On Mon, 3 Feb 2003, Kevin Ross wrote: > > > Date: Mon, 3 Feb 2003 16:25:29 -0600 > > From: Kevin Ross > > Reply-To: Jakarta Commons Users List > > To: 'Jakarta Commons Users List' > > Subject: RE: Digester + Logging + Ant NullPointerException > > > > I am using the latest and greatest. > > > > It is not that the code used Class.forName(), but the code uses the > > digester.getClassLoader().loadClass() that does *not* find the class. > > Switching to Class.forName() *works*. > > > > That implies to me that you don't have the configuration properties for > class loader selection correct. Making the change you propose would > destroy the ability to have commons-digester.jar in a parent class > loader, > but still be able to load classes from the child class loader (i.e. for > Tomcat, put commons-digester.jar in common/lib and try to load object > classes from your webapp. > > What property settings are you using for the "classLoader" and > "useContextClassLoader" properties? > > Craig > > > I made the changes in: > > ObjectCreateRule.java > > SetNextRule.java > > > > In addition, I had to change the FromXmlRuleSet: > > > > 1. Add beginning slash: > > public static final String DIGESTER_DTD_PATH = > > "/org/apache/commons/digester/xmlrules/digester-rules.dtd" > > > > 2. ln 153: URL dtdURL = getClass().getResource(DIGESTER_DTD_PATH); > > > > > > I have consistently seen the DTD issue (#2) in the tomcat 4.x > > environments (which we understand has classloading issues), now I see > > running in a forked process from ANT (with newenvironment="true"). I > > have always had to make my own builds. > > > > Why the need to obtain the classloader and load classes in this > manner? > > > > > > If tomcat and ant have this issue (possibly bad software), shouldn't > we > > find a better way to workaround this? At least a better message than > a > > NullPointerException with no stack.... > > > > I can provide a diff if your interested. I'm not sure of the answer, > I > > guess it hinges on the answer to my question of why it is done this > way. > > > > > > > > -Kevin > > > > > > > > -----Original Message----- > > From: Craig R. McClanahan [mailto:craigmcc@apache.org] > > Sent: Monday, February 03, 2003 3:33 PM > > To: Jakarta Commons Users List > > Subject: RE: Digester + Logging + Ant NullPointerException > > > > Which version of Digester are you using? There is only one occurrence > > of > > "Class.forName()" in the current code base (i.e. the version 1.4 that > > was > > just released), in DigesterRuleParser. Everything else (correctly) > uses > > digester.getClassLoader().loadClas(). > > > > Could you please try this with the latest and greatest Digester > release? > > > > Craig > > > > On Mon, 3 Feb 2003, Kevin Ross wrote: > > > > > Date: Mon, 3 Feb 2003 14:48:06 -0600 > > > From: Kevin Ross > > > Reply-To: Jakarta Commons Users List > > > > To: 'Jakarta Commons Users List' > > > Subject: RE: Digester + Logging + Ant NullPointerException > > > > > > I'm now using the latest cvs code for logging, which seems to get me > > > past the earlier problem, but nonetheless, the problem is now in the > > > digester: > > > > > > [java] [13:47:27.779-main][Digester][ERROR] - End event threw > > > exception > > > [java] java.lang.NullPointerException > > > [java] at > > > org.apache.commons.digester.SetNextRule.end(SetNextRule.java:248) > > > [java] at > > > org.apache.commons.digester.Digester.endElement(Digester.java:773) > > > [java] at > > > org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403) > > > [java] at > > > > > > org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValid > > > ator.java:1480) > > > [java] at > > > > > > org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentSc > > > anner.java:1809) > > > [java] at > > > > > > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatc > > > h(XMLDocumentScanner.java:1182) > > > [java] at > > > > > > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScan > > > ner.java:381) > > > [java] at > > > org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081) > > > [java] at > > > org.apache.commons.digester.Digester.parse(Digester.java:1222) > > > [java] at > > > > > > org.apache.commons.digester.xmlrules.FromXmlRuleSet.addRuleInstances(Fro > > > mXmlRuleSet.java:140) > > > [java] at > > > org.apache.commons.digester.Digester.addRuleSet(Digester.java:1311) > > > > > > > > > > > > > > > It is now clear that there are classloading issues (after inspecting > > > digester code). I switched in a couple of places the use of the > > > Digester.getClassloader().loadClass() for Class.forName() and > > everything > > > works. Is this a bug? Is there an incompatibility with ANT? > Problem > > > with 1.4.1? > > > > > > Kevin Ross > > > > > > > > > -----Original Message----- > > > From: Kevin Ross [mailto:Kevin.Ross@iverticalleap.com] > > > Sent: Monday, February 03, 2003 1:13 PM > > > To: commons-user@jakarta.apache.org > > > Subject: Digester + Logging + Ant NullPointerException > > > > > > I'm having yet another problem with logging. I figured someone else > > had > > > already uncovered this and discovered the issue (probably with my > > > environment). > > > > > > Environment > > > Win XP Pro > > > Java 1.4.1_01 > > > > > > I'm also using Log4j 1.2.7.jar. > > > > > > > > > [java] org.apache.commons.logging.LogConfigurationException: > > > java.lang.NullPointerException > > > [java] at > > > > org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:558) > > > [java] at > > > > org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:355) > > > [java] at > > > org.apache.commons.logging.LogFactory.getLog(LogFactory.java:409) > > > [java] at > > > org.apache.commons.digester.Digester.(Digester.java:281) > > > > > > > > > Any ideas? > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > > > For additional commands, e-mail: > commons-user-help@jakarta.apache.org > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > >