java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J
使用Guava - 18.0v和Cloud Storage - 2.2.2v时出现上述错误消息:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.2.0</version>
</dependency>
如果我将Guava - 23v与Datastax -3.2.0v一起使用,我将收到以下错误消息:
java.lang.NoClassDefFoundError: com/google/common/util/concurrent/FutureFallback
所以云存储需要 Guava 版本高于 20 ,但 DataStax 需要版本低于 20 ,所以任何一个都可以同时工作,但我想要这两样东西。
我的代码:
StorageOptions options = StorageOptions.newBuilder()
.setProjectId(PROJECT_ID)
.setCredentials(GoogleCredentials
.fromStream(new FileInputStream(PATH_TO_JSON_KEY))).build();
Storage storage = options.getService();
Blob blob = storage.get(BUCKET_NAME, OBJECT_NAME);
ReadChannel r = blob.reader();