hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rodrigo B. Campacci" <rbcampa...@yahoo.com.br>
Subject RE: Problem with Proxy Basic Authentication
Date Thu, 27 Jan 2011 03:28:05 GMT
Hi Oleg!

I surrounded httpClient.execute with an exclusive try/catch block:

try {
	response = httpClient.execute(httpMethod);
} catch (ClientProtocolException e) {
	e.printStackTrace();
	System.out.println("ClientProtocolException");
} catch (IOException e) {
	e.printStackTrace();
	System.out.println("IOException");
}

And I don't get anything printed in console. 
But jUnit in eclipse captured an exception stacktrace:
(sorry to don´t mention that before, I´m a little bit new at jUnit in Eclipse)

java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
	at org.apache.http.impl.auth.BasicScheme.authenticate(BasicScheme.java:164)
	at org.apache.http.impl.auth.BasicScheme.authenticate(BasicScheme.java:136)
	at org.apache.http.impl.auth.AuthSchemeBase.authenticate(AuthSchemeBase.java:124)
	at org.apache.http.client.protocol.RequestProxyAuthentication.process(RequestProxyAuthentication.java:98)
	at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:108)
	at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:174)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:452)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
	at xxx.publisher.impl.http.HttpPublisher.publish(HttpPublisher.java:103)
	at xxx.publisher.impl.test.HttpPublisherTest.testGenericPublish(HttpPublisherTest.java:55)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Thanks!

Rodrigo B. Campacci
rbcampacci@yahoo.com.br 

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: quarta-feira, 26 de janeiro de 2011 12:58
To: 'HttpClient User Discussion'
Subject: RE: Problem with Proxy Basic Authentication


> 2011/01/25 23:50:14:464 GMT [DEBUG] DefaultClientConnection - Receiving response: HTTP/1.0
407 Proxy Authentication Required
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << HTTP/1.0 407 Proxy Authentication
Required
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << Server: squid/2.6.STABLE6
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << Date: Tue, 25 Jan 2011 23:50:14
GMT
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << Content-Type: text/html
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << Content-Length: 1305
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << Expires: Tue, 25 Jan 2011 23:50:14
GMT
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << X-Squid-Error: ERR_CACHE_ACCESS_DENIED
0
> 2011/01/25 23:50:14:464 GMT [DEBUG] headers - << Proxy-Authenticate: Basic realm="*Enter
user and pwd*"
> 2011/01/25 23:50:14:465 GMT [DEBUG] headers - << X-Cache: MISS from prxinb.ptinovacao.com.br
> 2011/01/25 23:50:14:465 GMT [DEBUG] headers - << X-Cache-Lookup: NONE from prxinb.ptinovacao.com.br:8080
> 2011/01/25 23:50:14:465 GMT [DEBUG] headers - << Proxy-Connection: close
> 2011/01/25 23:50:14:470 GMT [DEBUG] DefaultHttpClient - Proxy requested authentication
> 2011/01/25 23:50:14:470 GMT [DEBUG] DefaultProxyAuthenticationHandler - Authentication
schemes in the order of preference: [negotiate, NTLM, Digest, Basic]
> 2011/01/25 23:50:14:471 GMT [DEBUG] DefaultProxyAuthenticationHandler - Challenge for
negotiate authentication scheme not available
> 2011/01/25 23:50:14:471 GMT [DEBUG] DefaultProxyAuthenticationHandler - Challenge for
NTLM authentication scheme not available
> 2011/01/25 23:50:14:471 GMT [DEBUG] DefaultProxyAuthenticationHandler - Challenge for
Digest authentication scheme not available
> 2011/01/25 23:50:14:471 GMT [DEBUG] DefaultProxyAuthenticationHandler - Basic authentication
scheme selected
> 2011/01/25 23:50:14:481 GMT [DEBUG] DefaultHttpClient - Authorization challenge processed
> 2011/01/25 23:50:14:481 GMT [DEBUG] DefaultHttpClient - Authentication scope: BASIC '*Enter
user and pwd*'@192.168.160.3:8080
> 2011/01/25 23:50:14:482 GMT [DEBUG] DefaultHttpClient - Found credentials
> 2011/01/25 23:50:14:482 GMT [DEBUG] DefaultClientConnection - Connection closed
> 2011/01/25 23:50:14:483 GMT [DEBUG] DefaultClientConnectionOperator - Connecting to /192.168.160.3:8080
> 2011/01/25 23:50:14:501 GMT [DEBUG] RequestAddCookies - CookieSpec selected: best-match

Everything looks perfectly normal until this line. Was there an
exception that caused the connection to shut down?

> 2011/01/25 23:50:14:505 GMT [DEBUG] DefaultClientConnection - Connection shut down
> 

Oleg



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


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


Mime
View raw message