1

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

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)

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

4

0 回答 0