我的程序包含以下行,并且此时挂起,我不太清楚为什么。
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
在Eclipse中调试时,如果我在Display视图中尝试评估“new PoolingHttpClientConnectionManager()”,我会收到以下错误:
java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
...omitted - referring to specific lines in code...
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.http.config.Lookup
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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 10 more
我正在使用org.apache.httpcomponents中的httpclient.jar版本4.3.1。
其他人遇到过这个问题?有解决方案吗或者我在做些傻事?
答案 0 :(得分:6)
你还有httpcore罐子吗? (4.3版本)我在那里找到了课程。
答案 1 :(得分:2)
org.apache.http.config。查找类不在httpclient-4.3.1.jar中。它位于httpcore-4.3.jar。
如果您不使用Maven,要了解httpclient依赖关系,请参阅http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/dependencies.html
答案 2 :(得分:1)
也许您忘了包含/下载HttpCore