tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: log4j error
Date Sat, 17 Nov 2007 00:15:58 GMT
> From: Steven Crosley [] 
> Subject: log4j error
> log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
> log4j:ERROR [org.apache.catalina.loader.StandardClassLoader@cbf30e]  
> whereas object of type
> log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by  
> [WebappClassLoader

This situation was reported earlier today in a different thread.  The
problem there was due to the following set of factors:

1) log4j*.jar in both Tomcat's lib directory and the webapp's

2) classes from Tomcat's lib directory making references to log4j

3) classes from the webapp making references to log4j

4) classes from the webapp calling methods in classes from Tomcat's lib

Even though the log4j jars may be identical, instances of log4j classes
are not assignable across the different classloaders used for Tomcat's
lib directory and the webapp.

The quick fix is to get rid of the log4j*.jar in your WEB-INF/lib, but
that precludes application-specifc logging.  You could also move
whatever classes from Tomcat's lib directory that the webapp needs into
WEB-INF/lib, rather than having them in the common location.  (This
would be more in keeping with the servlet spec philosophy, which tries
to keep webapps as independent as possible.)  Or, you could rework your
code a bit so the webapp passes a logging object to the methods that
need it that come from Tomcat's lib directory, and insure that the
shared classes don't hang onto that logger.  There may be other

 - Chuck

MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message