hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Murray <gmur...@Mines.EDU>
Subject HttpClient() throws ExceptionInInitializerError in JUnit swingui
Date Tue, 19 Jul 2005 21:17:26 GMT

I asked about this before and since I didn't get an answer I thought
I'd try again with more details.

HttpClient cannot be instantiated in junit.swingui.TestRunner, but
throws an ExceptionInInitializerError.  I've tried this with
httpclient-2.0.2 and httpclient-3.0-rc3 and various versions of
commons-logging.jar.  This is an easy bug to reproduce.  Compile the
HttpClientBug class below with

javac -classpath .:commons-httpclient-2.0.2.jar:junit_3.8.1.jar HttpClientBug.java

The class cannot be run without commons-logging.jar in the classpath,
since without it org/apache/commons/logging/LogFactory cannot be
found.  However, if commons-logging.jar is included, then this will

java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.textui.TestRunner

and this will fail:

java -cp .:commons-httpclient-2.0.2.jar:commons-logging.jar:junit_3.8.1.jar junit.swingui.TestRunner

I've verified it on Linux and WinXP with Java 1.5.  The Error messsage
complains that "You have more than one version of
'org.apache.commons.logging.Log' visible, which is not allowed," but
the only one is in commons-logging.jar.  Does anyone have a clue to
what is going on here?


import junit.framework.TestCase;
import org.apache.commons.httpclient.HttpClient;
public class HttpClientBug  extends TestCase {
   public void testIt() {
        System.out.println("Yo, "+System.getProperty("user.name")+"!");
        HttpClient client = new HttpClient();

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

View raw message