In AWS EC2 , java.lang.NoClassDefFoundError: org/apache/http/config/Lookup is thrown

Viewed 42

I use Apache HTTP to outsource certain parts of my program to AWS Lamda.

When I run this locally on a Windows system, everything works.

But when the program is deployed (EC2 Instance - ubuntu environment) and a request is started via apache http. I get the following error message:

java.lang.NoClassDefFoundError: org/apache/http/config/Lookup

I use the following maven dependencies:

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.15</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.13</version>
    </dependency>

At the following point in the code the error is thrown:

this.client = HttpClients.createDefault();

I have also tried other versions of Apache HTTP.

If you need more info let me know.

Can anyone tell me what I need to consider or what I may be doing wrong?

0 Answers
Related