Home > Back-end >  Java solution: Java. Lang. NoClassDefFoundError: org/apache/HTTP/client/HttpClient
Java solution: Java. Lang. NoClassDefFoundError: org/apache/HTTP/client/HttpClient

Time:12-04

Java. Lang. NoClassDefFoundError: org/apache/HTTP/client/HttpClient
When you run the server quote above error solution:
Recent projects in the registration are required to write a message validation, and then I use javaServlet + JSP + jquery. Ajax technology such as completed
But in the process of running out of an exception, the exception error I am looking for a morning, found the following solution
Due to the SMS authentication you need to import the
Commons logging - 1.1.1. Jar
Commons httpclient - 3.1. Jar
Commons - codec - 1.4. Jar
The jar package such as
So the error must be around the above jar package
The first:

Compilation can pass, the code should be no problem, it is likely to be dependent on the jar packages without packaging to the running environment, it can be a try, right click, properties, and then look at the picture, the error of the classes in the package ticked on


The second:
Lack of httpclient package,
Check for the jars on the WEB - INF lib directory,

Normal reference jar package, you should see this class,
1, do check whether the jar package reference;
2, delete, redistribute try again;

CodePudding user response:

So you need to use Maven, gradle build tools, these tools can automatically find and join the corresponding dependencies, rather than manual one by one to find myself,

CodePudding user response:

Use the maven build tool, such as
  • Related