我正在使用Google Cloud Platform API for Java(google-api-services-storage - v1beta2-rev39-1.17.0-rc)。
几个月它工作正常,但现在我执行操作时出现以下错误。
我没有找到错误出现的原因。我检查了是否有新版本的API,但v1beta2-rev39-1.17.0-rc是最后一个版本。
完整的堆栈跟踪
2014-36-19 12:36:11.791 [qtp1800676648-24 - PUT /track_processing/process/39793ae0-f936-4ef1-9629-bd36bc5aa469] ERROR com.xxx.common.cloud_storage.GoogleCloudStorageService - Error without Json body.com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request{
"error" : "invalid_client",
"error_description" : "The OAuth client was deleted."}
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Credential.java:570) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequestWithoutGZip(MediaHttpUploader.java:545) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequest(MediaHttpUploader.java:562) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.media.MediaHttpUploader.executeUploadInitiation(MediaHttpUploader.java:519) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.media.MediaHttpUploader.resumableUpload(MediaHttpUploader.java:384) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:336) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:418) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343) ~[track_processing.jar:0.0.1-SNAPSHOT]
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460) ~[track_processing.jar:0.0.1-SNAPSHOT]
这是已执行的代码
public URL upload(final InputStream mediaStream, long mediaStreamSize, final String filename) throws IOException {
InputStreamContent mediaContent = new InputStreamContent(MediaType.APPLICATION_OCTET_STREAM, mediaStream);
if (mediaStreamSize > 0)
mediaContent.setLength(mediaStreamSize); // Only an estimate, but allows google to optimize the upload
StorageObject objectMetadata = new StorageObject().setName(filename)
.setAcl(Lists.newArrayList(new ObjectAccessControl().setEntity("allUsers").setRole("READER")))
.setContentDisposition("attachment");
Storage.Objects.Insert insertObject = client.objects()
.insert(storageConfiguration.getBucketName(),
objectMetadata,
mediaContent);
insertObject.getMediaHttpUploader()
.setProgressListener(new UploadProgressListener(mediaStreamSize > 0))
.setDisableGZipContent(true);
if (mediaContent.getLength() > 0 && mediaContent.getLength() <= 2 * 1000 * 1000) {
logger.info("{} is a small file (<2mb)", filename);
insertObject.getMediaHttpUploader().setDirectUploadEnabled(true);
}
return new URL(insertObject.execute().getSelfLink());
}
此致 伊格纳西奥
答案 0 :(得分:1)
此问题似乎已在Stack Overflow问题的正常流程之外得到解决。我不确定它是应该删除还是根据惯例自行回答。考虑这是一个地方标记的答案,以防止这个解决的问题出现未解决的问题。