googleapis / java-bigquerystorage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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":

If you are still having issues, please include as much information as possible:

Environment details

  1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
    General, Core, and Other are also allowed as types

    Java writeCommittedStream in storage write API

  2. OS type and version:

  3. Java version: 11

  4. version(s):

Steps to reproduce

  1. ?
  2. ?

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.