Search code examples
javaspringwildfly

Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient


enter image description here

I have try to hit API then this type of error is occurs - org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient


Solution

  • NoClassDefFoundError means that the class was available while compiling but not able to find the definition at run time. Try by upgrading your httpclient depedency,

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.3</version>
    </dependency>
    

    And then run clean install