我想讀取Outlook日曆。所以我首先嚐試連接到服務器。我發現http://code.msdn.microsoft.com/exchange-ews-java-api-12-1a5a1143,只想獲得連接並嘗試。Java EWS拋出NoClassDefFound
我發現了一個例子,嘗試這樣做:
import microsoft.exchange.webservices.data.*;
...
public void test(){
ExchangeService es = new ExchangeService();
ExchangeCredentials credentials = new WebCredentials("user", "Password");
}
它崩潰的Exchange服務:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpConnectionManager
at ExchangeTest.test(ExchangeTest.java:15)
at Window.main(Window.java:19)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpConnectionManager
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
... 2 more
我試圖導入一個庫,但並沒有得到正確的或錯誤的別的東西。你能告訴我我需要哪個圖書館嗎?我可以在哪裏/如何修復它。謝謝。
我正在使用Win7。
它看起來像缺少對Apache HttpClient的依賴。確保你在classpath上有它,或者在pom.xml中,如果它是一個Maven項目。 –