jQuery in Action, 3rd edition
The moose likes Sockets and Internet Protocols and the fly likes HttpClient Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "HttpClient Exception" Watch "HttpClient Exception" New topic

HttpClient Exception

Hemal Mahagederawatte

Joined: Dec 17, 2008
Posts: 16
When i the following code as it is in http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e37 tutorial. I get the following exception when i run the following code.

The exception I get is follow.

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.protocol.BasicHttpContext: method <init>()V not found
at org.apache.http.impl.client.DefaultHttpClient.createHttpContext(DefaultHttpClient.java:205)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:532)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
at httpclient.Main.main(Main.java:31)
Java Result: 1

Can somebody help me please.
Thanks in advanced.

Hemal Mahagederawatte

Joined: Dec 17, 2008
Posts: 16
Finally after spending hours I found the answer.

I was using httpcore-4.0beta jar.

I replaced it with httpcore-4.1.jar and now it works fine
I agree. Here's the link: http://aspose.com/file-tools
subject: HttpClient Exception
It's not a secret anymore!