What could be the possible cause of this exception?
You may not have appropriate Jar in your class path.
How it could be removed?
By putting HTTPClient jar in your class path. If it's a webapp, copy Jar into WEB-INF/lib
if it's standalone, make sure you have this jar in class path or explicitly set using -cp
option
as the doc says,
Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.
Edit:
If you are using a dependency management like Maven/Gradle (see the answer below) or SBT please use it to bring the httpclient jar for you.