Error with JSONObject in writeCommittedStream while appending records
zeel1997 opened this issue · comments
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
- Search the issues already opened: https://github.com/googleapis/java-bigquerystorage/issues
- Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform
If you are still having issues, please include as much information as possible:
Environment details
-
Specify the API at the beginning of the title. For example, "BigQuery: ...").
General, Core, and Other are also allowed as typesJava writeCommittedStream in storage write API
-
OS type and version:
-
Java version: 11
-
version(s):
Steps to reproduce
- ?
- ?
Code example
for (int i = 0; i < 2; i++) {
// Create a JSON object that is compatible with the table schema.
JSONArray jsonArr = new JSONArray();
for (int j = 0; j < 10; j++) {
JSONObject record = new JSONObject();
record.put("col1", String.format("batch-record %03d-%03d", i, j));
jsonArr.put(record);
}
writer.append(jsonArr, offset);
offset += jsonArr.length();
}
Stack trace
Any relevant stacktrace here.
External references such as API reference guides
- ?
Any additional information below
Following these steps guarantees the quickest resolution possible.
Thanks!
Stack trace for the issue: java.lang.NoSuchMethodError: 'java.lang.String[] org.json.JSONObject.getNames(org.json.JSONObject)'
NoSuchMethodError is generally caused due to a dependency issue. Can you confirm you have the right version of the library and dependencies?
Closing due to lack of response for now. Feel free to reopen if you have more questions.