Bug 44899 - DOMConfigurator.findAppenderByName causes Nullpointer
DOMConfigurator.findAppenderByName causes Nullpointer
Status: RESOLVED FIXED
Product: Log4j
Classification: Unclassified
Component: Appender
1.2
All All
: P2 major
: ---
Assigned To: log4j-dev
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-04-28 17:40 UTC by Vijay
Modified: 2008-08-12 13:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vijay 2008-04-28 17:40:17 UTC
if the log4j.xml configuration file contains a custom appender for which the class cannot be located, then a ClassNotFoundException is thrown which is followed by a NullPointerException.

The appender at line 171 in 
file: DOMConfigurator.java 
function : findAppenderByName(Document doc, String appenderName)

Here are the two stack traces:

log4j:ERROR Could not create an Appender. Reported error follows.
java.lang.ClassNotFoundException: com.dvclabs.logging.client.log4jappender.LoggingInfrastructureAppender
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at org.apache.log4j.helpers.Loader.loadClass(Loader.java:179)
	at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:237)
	at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:171)
	at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184)
	at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:502)
	at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:471)
	at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:921)
	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:790)
	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:682)
	at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:811)
log4j:ERROR Could not parse file [metadata/log4j.xml].

java.lang.NullPointerException
	at java.util.Hashtable.put(Unknown Source)
	at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:172)
	at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184)
	at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:502)
	at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:471)
	at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:921)
	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:790)
	at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:682)
	at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:811)
Comment 1 Curt Arnold 2008-08-12 13:51:11 UTC
Committed rev 685308 in trunk, 685312 for extras.