googleapis / java-bigquery

Apache License 2.0
108 stars 119 forks source link

BigQuery :: java.lang.NoSuchMethodError: 'java.lang.String com.google.cloud.bigquery.BigQueryOptions.getResolvedApiaryHost(java.lang.String)' #3233

Closed pramod-prabhakar-kapase-db closed 2 days ago

pramod-prabhakar-kapase-db commented 5 months ago

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
  2. OS type and version: Windows Sprint boot application
  3. Java version: 17
  4. version(s): google-cloud-bigquery:2.38.2

Steps to reproduce

  1. Create BigQuery with option
  2. ?

Code example

BigQueryOptions.Builder bigQueryOptions = BigQueryOptions.newBuilder()
                .setProjectId(projectId);

        bigQueryOptions.setRetrySettings(RetrySettings.newBuilder()
                        .setMaxAttempts(10)
                        .setRetryDelayMultiplier(1.5)
                        .setTotalTimeout(Duration.ofMinutes(5))
                        .build())
                .setTransportOptions(HttpTransportOptions.newBuilder()
                        .setConnectTimeout(300000)//5 minutes
                        .setReadTimeout(300000)//5 minutes
                        .build());

        bigQueryOptions.setProjectId(projectId);

        return bigQueryOptions.build().getService();```

#### Stack trace

HttpBigQueryRpc: this.bigquery = (new Bigquery.Builder(transport, new GsonFactory(), initializer)).setRootUrl(options.getResolvedApiaryHost("bigquery")).setApplicationName(options.getApplicationName()).build();



getResolvedApiaryHost method not present in BigQueryOptions

#### External references such as API reference guides

- ?

#### Any additional information below

Following these steps guarantees the quickest resolution possible.

Thanks!
RaymondKADuncan commented 4 months ago

I've also run into this issue simply trying to run the following BigQuery bq = BigQueryOptions.getDefaultInstance().getService(); I checked the source code for a couple versions of the google-cloud-bigquery library and the offending class HttpBigQueryRpc.java attempts to call BigQueryOptions.getResolvedApiaryHost() on line 109 after version 2.36.0 even though the method doesn't exist. HttpBigQueryRpc.java also attempts to call the missing method BigQueryOptions.hasValidUniverseDomain() and BigQueryOptions.getUniverseDomain() in other paths of execution, but those don't appear to be causing the above issue as far as I can tell

RYenike commented 4 months ago

I also got same issue BigQuery bigquery = BigQueryOptions.newBuilder(). setCredentials(ServiceAccountCredentials.fromStream( new FileInputStream(System.getProperty("user.dir") + "\resources\json-files\adc.json"))).build().getService();

Any Resolution???

RaymondKADuncan commented 4 months ago

Until the code is updated to fix the exception you can resolve the issue by downgrading. I just downgraded to version 2.35.0 and don't have the issue anymore

PhongChuong commented 4 months ago

Hi @pramod-prabhakar-kapase-db , @RaymondKADuncan , @RYenike ,

I was not able to reproduce this issue. I created a new maven project and was able to create new BigQuery objects in v2.38.2 and v2.36.0 for both the provided example code and BigQuery bq = BigQueryOptions.getDefaultInstance().getService();. I suspect that this is caused by a dep issue. How are you adding google-cloud-bigquery as a dep. in your code? I.e., maven, maven without bom, Gradle, etc.

RaymondKADuncan commented 4 months ago

My project uses maven without the BOM. We're unable to use the BOM because we have our own parent project serving as a BOM and nesting one within another doesn't seem to be supported

PhongChuong commented 1 month ago

Sorry for the late update, The issue is likely caused by using an older version of the dependencies: com.google.cloud » google-cloud-core com.google.cloud » google-cloud-core-http (There could be potentially more, depending on your maven configuration). Specifically, google-cloud-core and google-cloud-core-http v2.28.0 and earlier. My suggestion is to update the versions of these dependencies to match with those required by BigQuery.

The command: mvn dependency:tree can also give a hint to where the dependency versions are coming from.

pkpkpk commented 1 week ago

FWIW had very similar issue, fix was excluding jackson in 3rd parties

shollyman commented 2 days ago

There doesn't appear to be an actionable item here for the library, so I'm going to close this issue out. Guidance related to verifying stale dependencies is still the general resolution here.