googleads / google-ads-java

Google Ads API Client Library for Java
Apache License 2.0
171 stars 176 forks source link

Getting error while upgrading google ads vdersion from v13 to v15. #774

Closed bipul31 closed 6 months ago

bipul31 commented 7 months ago

What is your question? While upgrading version from 13 to 15, I had to increase pom dependency as well. We have updated the version mentioned below.

<dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>google-ads</artifactId>
            <version>29.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.auth</groupId>
                    <artifactId>google-auth-library-credentials</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.api</groupId>
            <artifactId>gax</artifactId>
            <version>2.42.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.api</groupId>
            <artifactId>gax-grpc</artifactId>
            <version>2.42.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>33.0.0-jre</version>
        </dependency>
        <dependency>
            <groupId>com.google.auth</groupId>
            <artifactId>google-auth-library-credentials</artifactId>
            <version>1.23.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.auth</groupId>
            <artifactId>google-auth-library-oauth2-http</artifactId>
            <version>1.23.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>3.23.2</version>
        </dependency>

For these pom dependencies we have a dependency tree mention below

[INFO] +- com.google.api-ads:google-ads:jar:29.0.0:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:3.13.0:compile
[INFO] |  +- io.grpc:grpc-stub:jar:1.33.0:compile
[INFO] |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.18:runtime
[INFO] |  +- io.grpc:grpc-protobuf:jar:1.33.0:compile
[INFO] |  |  \- io.grpc:grpc-protobuf-lite:jar:1.33.0:compile
[INFO] |  +- com.google.auth:google-auth-library-credentials:jar:0.22.0:compile
[INFO] |  +- com.google.api-ads:google-ads-codegen:jar:29.0.0:compile
[INFO] |  |  +- com.google.api-ads:google-ads-stubs-lib:jar:29.0.0:compile
[INFO] |  |  +- com.google.api-ads:google-ads-stubs-v14:jar:29.0.0:compile
[INFO] |  |  +- com.google.api-ads:google-ads-stubs-v15:jar:29.0.0:compile
[INFO] |  |  \- com.squareup:javapoet:jar:1.11.1:compile
[INFO] |  +- com.google.protobuf:protobuf-java-util:jar:3.13.0:compile
[INFO] |  |  \- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] |  +- com.google.auto.service:auto-service:jar:1.0.1:runtime
[INFO] |  |  +- com.google.auto.service:auto-service-annotations:jar:1.0.1:runtime
[INFO] |  |  \- com.google.auto:auto-common:jar:1.2:runtime
[INFO] |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] |  \- com.google.auto.value:auto-value-annotations:jar:1.7.2:compile
[INFO] +- com.google.api:gax:jar:2.42.0:compile
[INFO] |  +- com.google.api:api-common:jar:1.10.0:compile
[INFO] |  +- com.google.api.grpc:proto-google-common-protos:jar:1.18.1:compile
[INFO] |  +- org.threeten:threetenbp:jar:1.6.8:compile
[INFO] |  \- io.opencensus:opencensus-api:jar:0.31.1:compile
[INFO] |     \- io.grpc:grpc-context:jar:1.33.0:compile
[INFO] +- com.google.api:gax-grpc:jar:2.42.0:compile
[INFO] |  +- io.grpc:grpc-api:jar:1.33.0:compile
[INFO] |  +- io.grpc:grpc-inprocess:jar:1.61.0:compile
[INFO] |  |  \- io.grpc:grpc-core:jar:1.33.0:compile
[INFO] |  |     +- com.google.android:annotations:jar:4.1.1.4:runtime
[INFO] |  |     \- io.perfmark:perfmark-api:jar:0.19.0:runtime
[INFO] |  +- io.grpc:grpc-alts:jar:1.33.0:compile
[INFO] |  |  +- io.grpc:grpc-grpclb:jar:1.33.0:compile
[INFO] |  |  \- org.conscrypt:conscrypt-openjdk-uber:jar:2.5.1:compile
[INFO] |  +- io.grpc:grpc-auth:jar:1.33.0:compile
[INFO] |  +- io.grpc:grpc-netty-shaded:jar:1.33.0:compile
[INFO] |  \- io.grpc:grpc-googleapis:jar:1.61.0:runtime
[INFO] |     \- io.grpc:grpc-xds:jar:1.61.0:runtime
[INFO] |        +- io.opencensus:opencensus-proto:jar:0.2.0:runtime
[INFO] |        +- io.grpc:grpc-util:jar:1.61.0:runtime
[INFO] |        +- io.grpc:grpc-services:jar:1.33.0:runtime
[INFO] |        \- com.google.re2j:re2j:jar:1.7:runtime
[INFO] +- com.google.guava:guava:jar:33.0.0-jre:compile
[INFO] |  +- com.google.guava:failureaccess:jar:1.0.2:compile
[INFO] |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- org.checkerframework:checker-qual:jar:3.41.0:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.23.0:compile
[INFO] |  \- com.google.j2objc:j2objc-annotations:jar:2.8:compile
[INFO] +- com.google.auth:google-auth-library-oauth2-http:jar:1.23.0:compile
[INFO] |  +- com.google.http-client:google-http-client:jar:1.37.0:compile
[INFO] |  |  \- io.opencensus:opencensus-contrib-http-util:jar:0.24.0:compile
[INFO] |  \- com.google.http-client:google-http-client-gson:jar:1.37.0:compile

And we are getting the following error :

Screenshot 2024-02-20 at 10 49 58 AM Screenshot 2024-02-20 at 10 50 05 AM

"Handler dispatch failed; nested exception is java.util.ServiceConfigurationError: io.grpc.LoadBalancerProvider: Provider io.grpc.xds.WeightedRoundRobinLoadBalancerProvider could not be instantiated"

Please help us to find the resolution for the same. Thanks

jradcliff commented 6 months ago

Could you check the entire dependency:tree output (not just the section from google-ads) to see if you have other io.grpc dependencies, either directly or indirectly? That error suggests that your project has such dependencies, and they are overriding the io.grpc version pulled in via the dependency on google-ads.

Thanks

bipul31 commented 6 months ago

Sharing the complete dependency tree. Can't see any other io.grpc dependency apart from google-ads dependency tree.txt

jradcliff commented 6 months ago

I just realized that you have the following:

        <dependency>
            <groupId>com.google.api</groupId>
            <artifactId>gax</artifactId>
            <version>2.42.0</version>
        </dependency>

Version 29.0.0 of google-ads depends on gax version 2.32.0. I suspect that's where the conflict is occurring.

I'm actually in the process of releasing 30.0.0 of google-ads today, which will upgrade the gax dependency to 2.43.0. You might want to wait a few hours and just upgrade straight to google-ads 30.0.0 and gax 2.43.0.

Thanks, Josh

jradcliff commented 6 months ago

Version 30.0.0 of com.google.api-ads:google-ads is now available.

bipul31 commented 6 months ago

Getting the same error with the version upgrade as well dependency tree.txt google_ads_error.txt using these google dependencies

      <dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>google-ads</artifactId>
            <version>30.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.auth</groupId>
                    <artifactId>google-auth-library-credentials</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.api</groupId>
            <artifactId>gax</artifactId>
            <version>2.43.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.api</groupId>
            <artifactId>gax-grpc</artifactId>
            <version>2.43.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>33.0.0-jre</version>
        </dependency>
        <dependency>
            <groupId>com.google.auth</groupId>
            <artifactId>google-auth-library-credentials</artifactId>
            <version>1.23.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.auth</groupId>
            <artifactId>google-auth-library-oauth2-http</artifactId>
            <version>1.23.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>3.23.2</version>
        </dependency>
jradcliff commented 6 months ago

I see that the dependency entries you have after google-ads are specifying versions that differ from what google-ads:30.0.0 uses:

Dependency your version google-ads:30.0.0 version
gax 2.43.0 2.43.0
guava 33.0.0 32.1.3
google-auth-library-* 1.23.0 1.23.0
protobuf-java 3.23.2 3.25.0

Could you update your pom to align the dependency sets and see if that changes the outcome of your test?

Also, looking at the end of your google_ads_error.txt file, I see the root cause is java.lang.VerifyError: Cannot inherit from final class while it's trying to instantiate io.grpc.xds.WeightedRoundRobinLoadBalancerProvider. Are there any other errors in your logs before the failure?

Thanks, Josh

bipul31 commented 6 months ago

Getting same error after updating the versions. Are there any other errors in your logs before the failure? No other error before the failure.

Thanks Bipul

jradcliff commented 6 months ago

Are you seeing the same results in all environments, or does it work on one host but not the other?

One option you could try is to enable verbose class loading logging in your Java process. Many JVMs support the -verbose:class argument for this, and it would allow you to see which JAR file the JVM is using for each class. That will tell us if something in your process is loading classes from a different version of the JARs than expected.

Thanks, Josh

jradcliff commented 6 months ago

It's been a few weeks since the last comment here, so I'm assuming this issue is resolved and will close it. However, feel free to reopen if you still have questions.

Thanks, Josh