Failing to create new PoolingHttpClientConnectionManager

11,230

Solution 1

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

Solution 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

Solution 3

Maybe you forgot to include/download HttpCore

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

Share:
11,230
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin almost 2 years

    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?