I have encountered an error that seems pretty common. Tried pretty much ALL the solutions recommended on here and some from other sites. Still no luck. I am using Eclipse Oxygen. I get this error on running. I am using a JAR which I have added to the project's lib folder (hence the import statement - which resolves fine). Any help would be greatly appreciated.
code:
package com.ed;
import microsoft.exchange.webservices.data.core.ExchangeService;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
ExchangeService service = new ExchangeService();
}
}
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager
at com.ed.Test.main(Test.java:8)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.HttpClientConnectionManager
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
Not sure which jar file you are using, maybe something similar to: https://mvnrepository.com/artifact/com.microsoft.ews-java-api/ews-java-api/2.0
If you are, then it has dependencies on other jars that must be included. The are listed in the link above. One of those is is httpclient: https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.4.1. Eclipse will not automatically download dependent jars. Build tools like maven or gradle will do that for you.