java—将客户端文件从服务器(部署在计算引擎上的spring boot应用程序)上传到google bucket

0x6upsns  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(189)

我试图上传我的客户的文件从springboot应用程序部署在gcp计算引擎到googlebucket。下面的代码将该文件上载到bucket中,但出现错误:

Resource resource = resourceLoader.getResource(GCP_AUTHENTICATION_FILE);
InputStream dbAsStream = resource.getInputStream();
String bucketName = GCP_BUCKET_NAME;
Storage storage = StorageOptions.newBuilder().setCredentials(GoogleCredentials.fromStream(dbAsStream))
                .setProjectId(GCP_PROJECT_ID).build().getService();
BlobId blobId = BlobId.of(bucketName, fileName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build();
storage.create(blobInfo, ClientFile.getBytes());

错误:

Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'com.google.api.client.util.DateTime com.google.api.services.storage.model.StorageObject.getCustomTime()'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题