3

My program contains the following line, and just hangs at this point, and I'm not quite sure why.

PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();

When debugging in Eclipse, if I try to evaluate "new PoolingHttpClientConnectionManager()" in the Display view I get these errors:

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

I am using httpclient.jar version 4.3.1 from org.apache.httpcomponents.

Anyone else experience this problem? Any solution? Or am I doing something silly?

user2816029
  • 43
  • 1
  • 1
  • 4

3 Answers3

6

Do you also have httpcore jar? (version 4.3 as well) I've found that class there.

Luciano
  • 8,552
  • 5
  • 32
  • 56
2

The org.apache.http.config.Lookup class is not in httpclient-4.3.1.jar. It is in httpcore-4.3.jar.

If you are not using Maven, to understand the httpclient dependencies, see http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/dependencies.html

Ken Lin
  • 1,819
  • 21
  • 21
1

Maybe you forgot to include/download HttpCore

http://hc.apache.org/downloads.cgi

Wouter
  • 3,976
  • 2
  • 31
  • 50