Я пытаюсь запустить код для чтения из bigquery и выполнить какое-либо преобразование с помощью spark.Получив приведенную ниже ошибку
Exception in thread "main" java.io.IOException: Error accessing: bucket: test-n, object: spark/output/wordcount
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl.wrapException(GoogleCloudStorageImpl.java:1707)
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl.getObject(GoogleCloudStorageImpl.java:1733)
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl.getItemInfo(GoogleCloudStorageImpl.java:1618)
at com.google.cloud.hadoop.gcsio.ForwardingGoogleCloudStorage.getItemInfo(ForwardingGoogleCloudStorage.java:214)
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageFileSystem.getFileInfo(GoogleCloudStorageFileSystem.java:1094)
at com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystemBase.getFileStatus(GoogleHadoopFileSystemBase.java:1422)
at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1426)
at com.spark.bigquery.App.main(App.java:67)
Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
"error" : "invalid_grant",
"error_description" : "Robot is missing a project number."
}
Я выполнил настройку учетной записи службы и электронной почты в коде.Разместил файл P12 тоже.
conf.set("fs.gs.project.id", projectId);
// Use service account for authentication. The service account key file is located at the path
// specified by the configuration property google.cloud.auth.service.account.json.keyfile.
conf.set(EntriesCredentialConfiguration.BASE_KEY_PREFIX +
EntriesCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX,
"true");
conf.set(EntriesCredentialConfiguration.BASE_KEY_PREFIX +
EntriesCredentialConfiguration.SERVICE_ACCOUNT_KEYFILE_SUFFIX,
"aesthetic-genre-216711-3a23f8112565.p12");
conf.set(EntriesCredentialConfiguration.BASE_KEY_PREFIX +
EntriesCredentialConfiguration.SERVICE_ACCOUNT_EMAIL_SUFFIX,
"reddevil.c06@gmail.com");