2012-09-28 143 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是否没有嵌入番石榴的副本。