commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: logging: more then one version of 'org.apache.commons.logging.Log' visible
Date Sat, 01 Oct 2005 03:11:39 GMT
On Thu, 2005-09-29 at 14:22 -0400, Kurt Guenther wrote:
> I'm using 1.0.4 of commons-logging. 
> 
> I'm getting this error from the LogFactory.getLog() method.  It complains about: 
> 
>     [junit] Caused by: 
> org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: Invalid class 
> loader hierarchy.  You have more than one version of 
> 'org.apache.commons.logging.Log' visible, which is not allowed.
> 
> But, I've checked the classpath very carefully and the only 
> 'org.apache.commons.logging.Log' is in the common-logging.jar file and 
> there's only one of these.   I even tried the "javap -classpath 
> list:of:paths  org.apache.commons.logging.Log" trick.   There's 
> definitely a copy in the classpath and when I remove the commons-logging 
> jar, the class is no longer defined.
> 
> The real kicker is this only occurs when I'm using the swing UI of Junit.  If I use the
Text UI or use the Junit Eclipse plug-in, it works perfectly fine.  
> 
> Could there be something about the swing UI class loader that's creating problems? 

junit does set up some odd classpaths when running tests.

You could try putting this code just before your call to
LogFactory.getLog():

ClassLoader cl = Thread.currentThread().getContextClassLoader();
Enumeration logs =
   cl.getResources("org/apache/commons/logging/Log.class");
// print out the contents of the logs enumeration

I bet you *will* find that there are multiple copies of Log available.

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message