commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <>
Subject Re: using commons-logging in webapp w/ log4j, can't find my properties
Date Sun, 15 Oct 2006 02:09:21 GMT

    Well now I'm really at my wit's end here--

I managed to successfully put all jars into my WEB-INF/lib such that 
there are no jars being used in the shared classpath of Tomcat and it 
still does not work! I'm only seeing the INFO level logged in 
catalina.out and debugging at INFO level for classes that I have not 
selected to be logged is being logged.

I've followed the documentation to the letter-- I simply put 
commons-logging-1.1.jar (knowing full well that Tomcat ships with an 
older version in its bin/ directory) and log4j-1.2.11 both in my 
WEB-INF/lib and then my in my WEB-INF/classes but it's 
never found unless I explicitly use the log4j PropertyConfigurator class 
to set the location manually.

Furthermore, in looking at the "Using JCL diagnostics" information, I 
put an updated commons-logging-1.1-api.jar in Tomcat/bin and when it 
starts up I see

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.apache.catalina.startup.Bootstrap.<clinit>(

when starting up even though I look at the jar file and it seems its there--

[fuzzmonkey:~/Jakarta/tomcat-5.5.17/bin] novotny% jar tvf 
commons-logging-api-1.1.jar | grep LogFactory
   600 Tue May 09 23:08:12 PDT 2006 
   839 Tue May 09 23:08:12 PDT 2006 
   900 Tue May 09 23:08:12 PDT 2006 
  1425 Tue May 09 23:08:12 PDT 2006 
  1277 Tue May 09 23:08:12 PDT 2006 
 21140 Tue May 09 23:08:12 PDT 2006 
 18619 Tue May 09 23:08:12 PDT 2006 

Does someone have even the simplest of WAR files bundled with a 
commons-logging, log4j jars and properties file that they claim works 
that I could test with maybe?

   Thanks, Jason

Kerrigan, Seamus wrote:
> Hi Jason,
> Perhaps you could call
> org.apache.commons.logging.LogFactory.release(java.lang.ClassLoader) to
> release any previously created LogFactory references associated with the
> classloader. The next call to LogFactory.getLog() should force
> commons-logging to rediscover the logging implementation.
> Regards,
> Seamus
> -----Original Message-----
> From: Jason Novotny [] 
> Sent: Saturday, October 14, 2006 8:50 PM
> To: Jakarta Commons Users List
> Subject: Re: using commons-logging in webapp w/ log4j, can't find my
> properties
>     I think I see my problem--
> My webapp first invokes a set of classes that are located in the 
> shared/lib classpath of Tomcat. Those classes also use commons-logging, 
> however there is no commons-logging jar in shared/lib alongside them, My
> hunch is they make use of the commons-logging.jar located in Tomcat/bin 
> directory that ships with tomcat. Then it would seem that when execution
> returns to my webapp, Tomcat classloading magic will just continue to 
> use the default logging properties and not my file.
>     I can manually make it all work just by doing
> PropertyConfigurator.configure(config.getServletContext().getRealPath("/
> WEB-INF/classes/"));
> at the top of my servlet, so I guess this appears to the best solution 
> for now.
>     Jason
> Dennis Lundberg wrote:
>> I'd suggest that you take a look at the troubleshooting guide for 
>> commons-logging, especially the section on how to turn on "Diagnostic 
>> logging":
> _Diagnostics 
>> That will show you what commons-logging is up to and where it finds 
>> its configuration.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message