commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Lee Yung Rowe <public_br...@muxspace.com>
Subject [logging] Invalid class loader hierarchy w/Ant+Hibernate+Logging (or the case of the unseen Log spectre)
Date Mon, 23 Aug 2004 17:16:57 GMT
Hi:

I'm using commons logging with Ant and Hibernate and am getting a class loader 
error which has me scratching my head. I'm sending to this list as I believe 
it to be a configuration issue with Logging as opposed to Hibernate. Evidence 
otherwise is certainly welcome.

First some background: I'm trying to run Hibernate's schema export taskdef via 
Ant. The versions of salient libraries are below:

Ant 1.6.1
Commons-Logging 1.0.4
Log4J 1.2.8
Hibernate 2.1

This is the error I'm getting:
--- Nested Exception ---
java.lang.ExceptionInInitializerError
        at 
net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:182)
        at 
net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
...
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.
at 
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)


I checked my classpath (with a home-grown utility) to verify that there is 
only one org.apache.commons.logging.Log class within all of the jars in the 
classpath. 

Running ant -diagnostic shows the ant-commons-logging.jar loaded via Ant. I 
removed this jar and got the same error.

Now the interesting part. I removed the commons-logging.jar from my classpath 
and now I get a 
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.apache.tools.ant.Project.executeTarget(Project.java:1224)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1063)

which I take to mean that I truly have only one copy of the commons-logging 
package in my classpath. 

So why does logging think there's an additional version of Log visible?

Any ideas are greatly appreciated.

Regards,
Brian

-- 
 =====
Brian Lee Yung Rowe (President, Chief Architect)
Cenozoa Corporation
3 East 28th Street, 9th Floor, New York 10016
646 536 3066
www.cenozoa.com

---------------------------------------------------------------------
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