Question: No JSON input found error message is displayed, if the Service account Key file is placed at external location
Hi Team,
For a Java project, if the Service Account key connection .json file is placed at an external location or at subfolder under the project root, No JSON Input found error message is displayed during runtime.
If the .json file is placed at the root level, the project runs without any issues.
Can you please help me with this. If there is any restriction from bigquery about this. Or what is the right way of doing it?
Thanks, Shruti
@danoscarmike @pmakani Request your help on this.
Which client are you trying to use for authentication? Also a code snippet of what you are attempting to do would help.
Hi @chingor13
We have recently migrated to https://github.com/googleapis/java-bigquery
PFB the sample code snippet.
public static BigQuery explicit() throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "projectId";
String jsonFilePath = "JSON_FILE_PATH.json";
InputStream is = null;
if(jsonFilePath != null && !jsonFilePath.isEmpty()){
is = new FileInputStream(jsonFilePath);
}
GoogleCredentials credentials = ServiceAccountCredentials.fromStream(is);
BigQuery bigquery = BigQueryOptions.newBuilder().setCredentials(credentials).setProjectId(projectId).build().getService();
return bigquery;
}
hi @chingor13 Any updates on this issue?
Closing this issue as we are unable to provide adequate customer support through this forum. If you feel there is a bug or a feature request associated with this ticket, please open a new issue. Otherwise, https://cloud.google.com/support is best able to provide timely answers to API-specific questions.