Have you tried putting the log4j lib in the WEB-INF/lib directory? That
should work, unless Orion is not fully supporting the WAR format or has bugs
in its classloader (or in the manner in which it is initializing its
ClassLoader).

Unfortunately, the Thread.currentThread().getContextClassLoader() is not an
approach that works reliably in all instances. The context ClassLoader is
set before a Thread starts and never changes after that. The Class.forName
method uses the ClassLoader of the calling class. So long as this
ClassLoader is the same as the context ClassLoader, or has the context
ClassLoader as its parent, then there is no reason why this should fail in
an instance where Thread.currentThread().getContextClassLoader() works. If
the context ClassLoader is not explicitly set, then the Thread inherits the
ClassLoader of its parent (which would typically be the same ClassLoader
initially used to load the application).

> -----Original Message-----
> From: Michiel Meeuwissen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 22, 2001 4:03 AM
> To: LOG4J Users Mailing List
> Subject: classloaders, DOMConfigurator
> 
> 
> We are using log4j in a servlet in Orion. But I put the log4j class in
> the Orion lib directory, because otherwise the servlet, (probably
> using the extension classloader), cannot find them.
> 
> I can also put our own classes, among which extended classes of
> Category and such, are in the WEB-INF/classes directory. This normally
> functioned fine. But the thing is, that DOMConfigurator now cannot
> find them. 
> 
> This probably has to do with using the wrong class loader.
> 
> Anyhow, I tried to change DOMConfigurator, to make it find the
> classes. This involved a few changes like:
> < Object instance     = Class.forName(className).newInstance();
> > Object instance   = 
> Thread.currentThread().getContextClassLoader().loadClass(class
> Name).newInstance();
> 
> and then it works. 
> 
> I think though that 'getContextClassLoader' is a Java 2 method, and
> therefore probably not acceptable.
> 
> I am no Java expert at all, but perhaps the solution for this problem
> presented by Ted Neward in his paper 'Understanding Class.forName'
> would be feasible?
> (http://www.javageeks.com/Papers/ClassForName/index.html)
> 
>  greetings, 
> 
>  Michiel
> 
> 
> -- 
> Michiel Meeuwissen - NOS internet 
> Mediacentrum kamer 203 - tel. +31 (0)35 6773065
> http://www.mmbase.org  
> http://www.purl.org/NET/mihxil/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to