aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "HttpClient Exception" Watch "HttpClient Exception" New topic
Author

HttpClient Exception

Hemal Mahagederawatte
Greenhorn

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
Greenhorn

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HttpClient Exception