【问题标题】:GCS client library NoSuchMethod systemNanoTimeGCS 客户端库 NoSuchMethod systemNanoTime
【发布时间】:2013-07-17 03:58:30
【问题描述】:

当我调用 createOrReplace 时,

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 

我查看了elipse中的pom文件依赖管理器,确定gcs-client库需要的guava版本是编译好的。

什么给出,有什么想法吗?

谢谢

【问题讨论】:

  • 与 GAE 的 mapreduce 相同
  • 为我找到了修复方法,见下文

标签: google-app-engine google-cloud-storage


【解决方案1】:

正如here 建议的那样,您的类路径和 Guava 上可能有一个 google-collections jar。确保将其删除。 如果使用 Maven

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

另见here

Guava 是旧 Google Collections Library 的完全兼容的超集。它还包括多年的错误修复、文档修复和性能修复,因此我们强烈建议您使用 Guava 而不是 Google Collections。

如果您的应用程序最终在同一个类路径上同时包含 google-collect-1.0.jar 和 guava-r##.jar,只需删除 Google Collections JAR 就可以了。如果你不删除它,它要么会导致严重的问题(如果它出现在类路径中的番石榴之前),要么永远不会被看到(如果它出现在之后)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-06
    • 2015-03-19
    • 2015-04-26
    • 1970-01-01
    • 1970-01-01
    • 2014-08-25
    • 2011-01-27
    相关资源
    最近更新 更多