I am using Struts2 framework and using HttpClient class for making put request.
When I try to call httpClient’s requestEntity method in LoginAction class I am getting the following error.
SEVERE: Exception starting filter struts2
java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
I have included all the required jar files in the class path.
Kindly help me figure out what could be the problem.
If you are using older version( apache commons less than 3.0) then that class will not be available in old jar. You have to use
Apache commons 3.0library.org/apache/commons/httpclient/methods/RequestEntityclass is added sincev3.0. Check javadoc.Generally If we do not have jar added in classpath(or not in project) then we get
ClassNotFoundExceptionand if we have jar included in project and it is in classpath but particular class is not available then we getNoClassDefFoundError.