2012-09-28 144 views
2

我正在編寫一個javafx應用程序來檢索谷歌聯繫人。番石榴和javafx

清理並使用netbeans構建應用程序並在我的web瀏覽器(firefox)中執行應用程序後,一切順利,但是當應用程序位於不同的服務器時,應用程序會拋出「ClassCircularityError」與「com.google。 common.collect.Multisets」。

此錯誤,只有當應用程序試圖執行下一個代碼發生:

ContactFeed result = service.getFeed(url, ContactFeed.class); 

,這是錯誤:

java.lang.ClassCircularityError: com/google/common/collect/Multisets 
at com.google.common.collect.AbstractMultiset.iterator(AbstractMultiset.java:64) 
at com.google.common.collect.ConcurrentHashMultiset.iterator(ConcurrentHashMultiset.java:57) 
at com.google.gdata.client.SimpleCookieManager.getCookies(SimpleCookieManager.java:72) 
at com.google.gdata.client.GoogleService.getCookies(GoogleService.java:530) 
at com.google.gdata.client.http.GoogleGDataRequest$GoogleCookieHandler.get(GoogleGDataRequest.java:358) 
at sun.net.www.protocol.http.HttpURLConnection.setCookieHeader(HttpURLConnection.java:1180) 
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:612) 
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1320) 
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(HttpURLConnection.java:2683) 
at com.google.gdata.client.http.HttpGDataRequest.isOAuthProxyErrorResponse(HttpGDataRequest.java:566) 
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:557) 
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538) 
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536) 
at com.google.gdata.client.Service.getFeed(Service.java:1135) 
at com.google.gdata.client.Service.getFeed(Service.java:1077) 
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:676) 
at com.google.gdata.client.Service.getFeed(Service.java:1034) 
at mypackage.myApp.start(myApp.java:51) 
at com.sun.javafx.applet.FXApplet2$1.run(FXApplet2.java:131) 
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173) 
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76) 

「com.google.common.collect.Multisets」 是裏面番石榴。

我不知道爲什麼應用程序失敗時,一切都位於不同的服務器,而不是我的本地機器。

回答

1

看起來你在類路徑上有一些Guava類的多個版本,導致類加載期間發生錯誤。確保你的類路徑中沒有guava jar的多個版本,或者guava.jar和google-collections.jar(舊的項目)。並檢查gdata客戶端jar是否沒有嵌入番石榴的副本。