2013-07-17 49 views
3

當我打電話createOrReplace,GCS客戶端庫NoSuchMethod systemNanoTime

private GcsService gcsService = 
GcsOutputChannel outputChannel = gcsService.createOrReplace(file, GcsFileOptions.getDefaultInstance()); 

我看到

java.lang.NoSuchMethodError: com.google.common.base.Platform.systemNanoTime()J 
at com.google.common.base.Ticker$1.read(Ticker.java:60) 
at com.google.common.base.Stopwatch.start(Stopwatch.java:114) 
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:88) 
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:138) 
at com.google.appengine.tools.cloudstorage.GcsServiceImpl.createOrReplace(GcsServiceImpl.java:47) 
at com.train.trainercircle.rest.ImageResource.getExercises(ImageResource.java:72) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:45) 
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) 
at 

我看着在POM文件的依賴經理elipse並確保通過gcs-所需要的版本番石榴客戶端庫是編譯的。

什麼給,有什麼想法?

感謝

+0

同樣在這裏用GAE的mapreduce – ZiglioUK

+0

爲我找到了一個修復程序,見下文 – ZiglioUK

回答

2

至於建議here你可能對你的類路徑以及番石榴一個谷歌的集合罐子。確保刪除它。 如果使用Maven

<exclusions> 
    <exclusion> 
    <artifactId>google-collect</artifactId> 
    <groupId>com.google</groupId> 
    </exclusion> 
</exclusions> 

參見here

番石榴是老谷歌集合庫的完全兼容的超集。它還包括數年的錯誤修復,文檔修復和性能修復,因此我們強烈建議您使用Guava而不是Google Collections。

如果您的應用程序在同一個類路徑中同時包含google-collect-1.0.jar和guava-r ##。jar,只需刪除Google Collections JAR即可。如果你不刪除它,它可能會導致可怕的問題(如果它出現在classpath中的番石榴之前)或者永遠不會被看到(如果它在後面)。