NoClassDefFoundError
--------------------
Key: HTTPCLIENT-793
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-793
Project: HttpComponents HttpClient
Issue Type: Question
Components: HttpClient
Affects Versions: 4.0 Beta 1
Environment: MAC OSX, Running Authentication example, using eclipse3.2
Reporter: Patrick Conway
I downloaded HttpClient and HttpCore. I want to create a java program which
can access my password protected webpage
But I canot get the example to run
Here is the error and the code.
=========ERROR===========
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory
at
org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:84)
at
org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:128)
at com.mapflow.siteMonitor.SiteMonitor.main(SiteMonitor.java:30)
=========CODE===========
package com.mapflow.siteMonitor;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
/**
* @author patrick
*
*/
public class SiteMonitor {
/**
* @param args
* @throws IOException
* @throws ClientProtocolException
*/
public static void main(String[] args) throws ClientProtocolException,
IOException {
// TODO Auto-generated method stub
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials(
new AuthScope("******", 80),
new UsernamePasswordCredentials("*****", "*****"));
HttpGet httpget = new HttpGet("**********");
System.out.println("executing request" + httpget.getRequestLine());
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
if (entity != null) {
System.out.println("Response content length: " +
entity.getContentLength());
System.out.println("Chunked?: " + entity.isChunked());
}
if (entity != null) {
entity.consumeContent();
}
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]