针对apache HTTPClient的PostMethod出错

时间:2013-03-03 16:03:58

标签: java eclipse httpclient

我正在尝试在java中实现HTTPClient。代码如下:

try {
    // Main page
    // Search by State, City
    HttpClient client = new HttpClient();
    PostMethod post = new PostMethod("http://www.cholainsurance.com/nwhosp/");

在post方法中我收到以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
    at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
    at org.apache.commons.httpclient.methods.ExpectContinueMethod.<init>(ExpectContinueMethod.java:93)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.<init>(EntityEnclosingMethod.java:119)
    at org.apache.commons.httpclient.methods.PostMethod.<init>(PostMethod.java:106)
    at com.parser.CHOLAHospitals.getHospitals(CHOLAHospitals.java:37)
    at com.parser.MYMain.main(MYMain.java:12)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)

这可能很简单。有人可以帮忙。

0 个答案:

没有答案