0
votes

I'm attempting to build my a .war file for my web module and exporting it to an autodeploy folder. However, it always crashes on this error:

Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest

I'm using Eclipse Luna as my IDE and all the apache jars are added to my build path. Is there somewhere else I have to add them for this to work?

enter image description here

2

2 Answers

0
votes

Check if you have HttpClient dependency in your POM file. If not, you've to add:

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

If you are not using maven, download the jar and add in your classpath.

0
votes

you should place apache jars to your web project's > Webcontent > WEB-INF > lib folder.

it seems your code succesfsully compiling because they are on your project's classpath. but on runtime, your web project's classpath does not have a meaning (it is for compile time). on runtime those apache jars should be somewhere on runtime classpath (somewhere like WEB-INF/lib folder or EAR/lib folder or application server's runtime classpath etc...)