commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Galbraith" <pgalbra...@trigoncanada.com>
Subject [Logging] ClassLoader hierarchy problems under JUnit swingui TestRunner
Date Tue, 03 Aug 2004 21:59:30 GMT
I made a very simple class that created a static log instance, and ran
it under JUnit's swing testrunner, and commons logging puked with
exceptions regarding an invalid ClassLoader hierarchy.  Have I done
something stupid?  Or is this just a fact of life, and I can't test
logging apps using JUnit's GUI TestRunner?

Cheers,

Paul

------------

For reference, I'm using JUnit 3.8.1, Logging 1.04, and Sun JDK 1.4.2.
My test class is:

import junit.framework.*;
import org.apache.commons.logging.*;

public class TestLogging extends TestCase {
    private static Log log = LogFactory.getLog(TestLogging.class);
    public void testLogging() {
	assertTrue(log != null);
    }
}

Compiling and running "java -classpath '.;junit.jar;commons-logging.jar'
junit.swingui.TestRunner TestLogging" dumps the exception stack trace to
the console.

Here is the output I see:

----------

java.lang.ExceptionInInitializerError
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at junit.framework.TestSuite.createTest(TestSuite.java:131)
	at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
	at junit.framework.TestSuite.<init>(TestSuite.java:75)
	at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:103)
	at junit.swingui.TestRunner.runSuite(TestRunner.java:591)
	at
junit.swingui.TestRunner$9.actionPerformed(TestRunner.java:283)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown
Source)
	at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown
Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown
Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.apache.commons.logging.LogConfigurationException:
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. (Caused
by 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.) (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. (Caused
by 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.newInstance(LogFactoryImp
l.java:543)
	at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:235)
	at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImp
l.java:209)
	at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
	at TestLogging.<clinit>(TestLogging.java:5)
	... 33 more
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. (Caused
by 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(LogFact
oryImpl.java:397)
	at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImp
l.java:529)
	... 37 more
Caused by: 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(LogFact
oryImpl.java:385)
	... 38 more


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