DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16457>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16457

NullPointerException in LogFactory





------- Additional Comments From [EMAIL PROTECTED]  2003-01-31 15:21 -------
Sorry if this is obvious, but I'm going to ask anyway: Were you expecting 'step 
four' to find YOUR factory?  If so, that would explain the confusion.  'step 
four' finds the DEFAULT.

FYI,

In a J2SE environment where you are using CLASSPATH to point to commons-
logging.jar and yourOwn.jar, then you are correct - using context class loader 
is OK.  In a J2EE environment with commons-logging installed at a system level, 
and your code as a web application, then the class loader hierarchy looks 
(loosely) like:

webAppClassLoader -> EARFileClassLoader -> SystemClassLoader -> ..

So, if you use the context class loader, then you are unnecessarily walking up 
the tree to find something in SystemClassLoader.  In this example, 
LogFactory.class.getClassLoader() == SystemClassLoader(), which is no more and 
no less than what is required to find the companion class in the same jar file 
with LogFactory.  The 'extra logic' that makes all that happen is to avoid 
walking the class loader chain - maybe a small nit, but it's something.

BTW, I incorrectly stated previously that you could overload the 
FACTORY_DEFAULT by placing a class in the lower [i.e webApp] classloader... 
default/standard behavior is to defer up the hierarchy for class resolution 
before looking at local class loader).  As you pointed out, in your hierarchy 
it appears that it's found by the bootstrap class loader, which can be returned 
as null.. that's odd to my simple mind, but that's the documented (and 
functional) behavior.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to