googleads / google-ads-java

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

Could not initialize class ApiCatalogImpl #348

Closed ashhade closed 3 years ago

ashhade commented 3 years ago

Which version of the client library are you using? v5 (9.0.0) Which version of Java are you using? 1.8 Which operating system (Linux, Windows, ...) and version? macos Actions taken

        Properties pro=new Properties();
        pro.put(GoogleAdsClient.Builder.ConfigPropertyKey.CLIENT_ID.getPropertyKey(),this.auth2AppDetails.keyOrId);
        pro.put(GoogleAdsClient.Builder.ConfigPropertyKey.CLIENT_SECRET.getPropertyKey(),this.auth2AppDetails.secret);
        pro.put(GoogleAdsClient.Builder.ConfigPropertyKey.REFRESH_TOKEN.getPropertyKey(),this.refreshToken);
        pro.put(GoogleAdsClient.Builder.ConfigPropertyKey.DEVELOPER_TOKEN.getPropertyKey(),this.developerToken);
        return  GoogleAdsClient.newBuilder().fromProperties(pro).build();

Expected result to return GoogleAdsClient Actual result

[2020-10-06 11:15:20.000] - 53445 SEVERE [http-nio-8090-exec-7] --- org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.google.ads.googleads.lib.catalog.ApiCatalogImpl] with root cause
java.lang.NoClassDefFoundError: Could not initialize class com.google.ads.googleads.lib.catalog.ApiCatalogImpl
    at com.google.ads.googleads.lib.catalog.ApiCatalog.getDefault(ApiCatalog.java:32)
    at com.google.ads.googleads.lib.GoogleAdsClient$Builder.build(GoogleAdsClient.java:360)
    at com.datorama.integrations.google.ads.GoogleAds.getGoogleAdsClient(GoogleAds.java:51)

Anything else we should know about your project / environment

nwbirnie commented 3 years ago

It looks like there's an incorrect settings when you're constructing the builder. In GoogleAdsClient.newBuilder() it should call builder.setEnableGeneratedCatalog(true) for some reason it appears that is being overridden in your implementation. Could you try adapting your client creation code to: GoogleAdsClient.newBuilder().fromProperties(pro).setEnableGeneratedCatalog(true).build(); please?

ashhade commented 3 years ago

setEnableGeneratedCatalog(true).build(); return GoogleAdsClient.newBuilder().fromProperties(pro).setEnableGeneratedCatalog(true).build(); it's failed on the build() method result

[2020-10-06 12:52:45.816] - 84718 SEVERE [http-nio-8090-exec-2] --- org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.google.ads.googleads.lib.catalog.GeneratedCatalog] with root cause java.lang.NoClassDefFoundError: Could not initialize class com.google.ads.googleads.lib.catalog.GeneratedCatalog at com.google.ads.googleads.lib.GoogleAdsClient$Builder.build(GoogleAdsClient.java:356) at com.datorama.integrations.google.ads.GoogleAds.getGoogleAdsClient(GoogleAds.java:51)

nwbirnie commented 3 years ago

It looks like the initialization fails for both the generated and hard coded catalogs. This would suggest that you don't have the annotation processor module on your classpath. Can you add a dependency on com.google.api-ads:google-ads-annotation-processing:9.0.0 please?

Also is there another exception being hidden further up the logs perhaps?

Failing that please provide the full dependency tree, e.g. with maven: mvn dependency:tree -f path/to/your/pom.xml.

ashhade commented 3 years ago

no when get the build() it's fail nothing else appear this is my dependency

        <dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>google-ads</artifactId>
            <version>9.0.0</version>
        </dependency>

tree result

[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------< com.datorama.integrations:google-ads >----------------
[INFO] Building google-ads 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) @ google-ads ---
[INFO] com.datorama.integrations:google-ads:jar:0.0.1-SNAPSHOT
[INFO] +- com.datorama.integrations:basemarket:jar:0.0.1-SNAPSHOT:compile
[INFO] |  +- com.datorama.integrations:base:jar:0.0.1-SNAPSHOT:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.20.RELEASE:compile
[INFO] |  |  |  \- org.aspectj:aspectjweaver:jar:1.8.14:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-mail:jar:1.5.20.RELEASE:compile
[INFO] |  |  |  +- org.springframework:spring-context-support:jar:4.3.23.RELEASE:compile
[INFO] |  |  |  \- com.sun.mail:javax.mail:jar:1.5.6:compile
[INFO] |  |  +- org.freemarker:freemarker:jar:2.3.28:compile
[INFO] |  |  +- com.google.apis:google-api-services-oauth2:jar:v2-rev89-1.20.0:compile
[INFO] |  |  +- com.google.http-client:google-http-client-jackson:jar:1.23.0:compile
[INFO] |  |  |  \- com.google.http-client:google-http-client:jar:1.23.0:compile
[INFO] |  |  +- com.google.http-client:google-http-client-jackson2:jar:1.28.0:compile
[INFO] |  |  +- com.google.apis:google-api-services-youtube:jar:v3-rev198-1.18.0-rc:compile
[INFO] |  |  +- commons-io:commons-io:jar:2.4:compile
[INFO] |  |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  |  +- org.apache.httpcomponents:httpclient:jar:4.5.8:compile
[INFO] |  |  |  \- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] |  |  +- com.datorama:timbermill-adapter:jar:1.0.20:compile
[INFO] |  |  |  +- com.datorama:timbermill-client:jar:1.1.19:compile
[INFO] |  |  |  |  \- com.datorama:timbermill-common:jar:1.2.15:compile
[INFO] |  |  |  |     +- org.springframework.data:spring-data-redis:jar:1.8.20.RELEASE:compile
[INFO] |  |  |  |     |  +- org.springframework.data:spring-data-keyvalue:jar:1.2.20.RELEASE:compile
[INFO] |  |  |  |     |  |  \- org.springframework.data:spring-data-commons:jar:1.13.20.RELEASE:compile
[INFO] |  |  |  |     |  +- org.springframework:spring-tx:jar:4.3.23.RELEASE:compile
[INFO] |  |  |  |     |  +- org.springframework:spring-oxm:jar:4.3.23.RELEASE:compile
[INFO] |  |  |  |     |  \- org.slf4j:jcl-over-slf4j:jar:1.7.26:runtime
[INFO] |  |  |  |     \- com.jayway.awaitility:awaitility:jar:1.7.0:compile
[INFO] |  |  |  |        \- cglib:cglib-nodep:jar:3.1:compile
[INFO] |  |  |  \- com.datorama.oss:timbermill-client:jar:2.1.38:compile
[INFO] |  |  +- com.datorama:microparent-redis:jar:2.3.2:compile
[INFO] |  |  |  +- org.redisson:redisson:jar:2.10.3:compile
[INFO] |  |  |  |  +- io.netty:netty-common:jar:4.1.15.Final:compile
[INFO] |  |  |  |  +- io.netty:netty-codec:jar:4.1.15.Final:compile
[INFO] |  |  |  |  +- io.netty:netty-buffer:jar:4.1.15.Final:compile
[INFO] |  |  |  |  +- io.netty:netty-transport:jar:4.1.15.Final:compile
[INFO] |  |  |  |  |  \- io.netty:netty-resolver:jar:4.1.15.Final:compile
[INFO] |  |  |  |  +- io.netty:netty-handler:jar:4.1.15.Final:compile
[INFO] |  |  |  |  +- javax.cache:cache-api:jar:1.0.0:compile
[INFO] |  |  |  |  +- io.projectreactor:reactor-stream:jar:2.0.8.RELEASE:compile
[INFO] |  |  |  |  |  \- io.projectreactor:reactor-core:jar:2.0.8.RELEASE:compile
[INFO] |  |  |  |  |     \- org.reactivestreams:reactive-streams:jar:1.0.0:compile
[INFO] |  |  |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.11:compile
[INFO] |  |  |  |  +- net.bytebuddy:byte-buddy:jar:1.6.14:compile
[INFO] |  |  |  |  \- org.jodd:jodd-bean:jar:3.7.1:compile
[INFO] |  |  |  |     \- org.jodd:jodd-core:jar:3.7.1:compile
[INFO] |  |  |  +- de.javakaffee:kryo-serializers:jar:0.37:compile
[INFO] |  |  |  |  \- com.esotericsoftware:kryo:jar:3.0.3:compile
[INFO] |  |  |  |     +- com.esotericsoftware:reflectasm:jar:1.10.1:compile
[INFO] |  |  |  |     \- com.esotericsoftware:minlog:jar:1.3.0:compile
[INFO] |  |  |  \- org.hibernate:hibernate-core:jar:5.0.12.Final:compile
[INFO] |  |  |     +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  |     +- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |  |  |     +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  |     +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] |  |  |     +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] |  |  |     +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  |     \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  |  +- com.datorama:microparent-common:jar:2.2.0:compile
[INFO] |  |  |  \- com.logentries:logentries-appender:jar:1.1.38:compile
[INFO] |  |  +- com.datorama:common:jar:1.3.10:compile
[INFO] |  |  |  +- org.json:json:jar:20140107:compile
[INFO] |  |  |  +- com.microsoft.azure:azure-storage:jar:5.0.0:compile
[INFO] |  |  |  |  \- com.microsoft.azure:azure-keyvault-core:jar:0.8.0:compile
[INFO] |  |  |  +- com.opencsv:opencsv:jar:3.9:compile
[INFO] |  |  |  +- com.amazonaws:aws-java-sdk-sqs:jar:1.11.125:compile
[INFO] |  |  |  |  +- com.amazonaws:aws-java-sdk-core:jar:1.11.125:compile
[INFO] |  |  |  |  |  +- software.amazon.ion:ion-java:jar:1.0.2:compile
[INFO] |  |  |  |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.11:compile
[INFO] |  |  |  |  \- com.amazonaws:jmespath-java:jar:1.11.125:compile
[INFO] |  |  |  +- com.amazonaws:aws-java-sdk-s3:jar:1.11.125:compile
[INFO] |  |  |  |  \- com.amazonaws:aws-java-sdk-kms:jar:1.11.125:compile
[INFO] |  |  |  +- org.apache.commons:commons-lang3:jar:3.6:compile
[INFO] |  |  |  +- org.apache.commons:commons-compress:jar:1.14:compile
[INFO] |  |  |  +- net.openhft:zero-allocation-hashing:jar:0.8:compile
[INFO] |  |  |  +- com.rabbitmq:amqp-client:jar:4.8.3:compile
[INFO] |  |  |  \- com.amazonaws:aws-java-sdk-sts:jar:1.11.125:compile
[INFO] |  |  \- net.sf.supercsv:super-csv:jar:2.3.1:compile
[INFO] |  +- com.google.apis:google-api-services-dfareporting:jar:v3.3-rev20190206-1.28.0:compile
[INFO] |  +- com.google.api-client:google-api-client:jar:1.23.0:compile
[INFO] |  |  +- com.google.oauth-client:google-oauth-client:jar:1.23.0:compile
[INFO] |  |  \- com.google.guava:guava-jdk5:jar:17.0:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.10:compile
[INFO] |  +- com.amazonaws:aws-java-sdk:jar:1.2.1:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13-cloudera.2:compile (version selected from constraint [1.4,))
[INFO] |  |  +- javax.mail:mail:jar:1.5.0-b01:compile (version selected from constraint [1.4,))
[INFO] |  |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  \- com.github.salesforce-marketingcloud:fuelsdk:jar:1.5.0:compile
[INFO] |     +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] |     |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |     +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:3.1.2:compile
[INFO] |     |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |     |  +- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] |     |  +- org.apache.cxf:cxf-core:jar:3.1.2:compile
[INFO] |     |  |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] |     |  |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] |     |  |  \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] |     |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.1.2:compile
[INFO] |     |  |  +- org.apache.cxf:cxf-rt-wsdl:jar:3.1.2:compile
[INFO] |     |  |  |  \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] |     |  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.1.2:compile
[INFO] |     |  |     +- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile
[INFO] |     |  |     \- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
[INFO] |     |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:3.1.2:compile
[INFO] |     |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:3.1.2:compile
[INFO] |     |  \- org.apache.cxf:cxf-rt-ws-addr:jar:3.1.2:compile
[INFO] |     |     \- org.apache.cxf:cxf-rt-ws-policy:jar:3.1.2:compile
[INFO] |     |        \- org.apache.neethi:neethi:jar:3.0.3:compile
[INFO] |     \- org.apache.cxf.xjc-utils:cxf-xjc-runtime:jar:3.0.5:compile
[INFO] |        \- javax.xml.bind:jaxb-api:jar:2.2.12:compile
[INFO] +- com.google.api-ads:google-ads:jar:9.0.0:compile
[INFO] |  +- com.google.api:gax:jar:1.57.1:compile
[INFO] |  |  +- com.google.guava:guava:jar:18.0:compile
[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  |  +- org.threeten:threetenbp:jar:1.4.1:compile
[INFO] |  |  +- com.google.auth:google-auth-library-oauth2-http:jar:0.21.0:compile
[INFO] |  |  |  \- com.google.auto.value:auto-value-annotations:jar:1.7.2:compile
[INFO] |  |  +- com.google.api:api-common:jar:1.9.3:compile
[INFO] |  |  \- io.opencensus:opencensus-api:jar:0.24.0:compile
[INFO] |  |     \- io.grpc:grpc-context:jar:1.22.1:compile
[INFO] |  +- com.google.api:gax-grpc:jar:1.57.1:compile
[INFO] |  |  +- io.grpc:grpc-stub:jar:1.30.0:compile
[INFO] |  |  |  +- io.grpc:grpc-api:jar:1.30.0:compile
[INFO] |  |  |  +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] |  |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.18:runtime
[INFO] |  |  +- io.grpc:grpc-auth:jar:1.30.0:compile
[INFO] |  |  +- io.grpc:grpc-protobuf:jar:1.30.0:compile
[INFO] |  |  |  +- com.google.protobuf:protobuf-java:jar:3.12.0:compile
[INFO] |  |  |  \- io.grpc:grpc-protobuf-lite:jar:1.30.0:compile
[INFO] |  |  +- com.google.auth:google-auth-library-credentials:jar:0.21.0:compile
[INFO] |  |  +- com.google.api.grpc:proto-google-common-protos:jar:1.17.0:compile
[INFO] |  |  +- io.grpc:grpc-netty-shaded:jar:1.30.0:compile
[INFO] |  |  |  \- io.grpc:grpc-core:jar:1.30.0:compile (version selected from constraint [1.30.0,1.30.0])
[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.30.0:compile
[INFO] |  |     +- io.grpc:grpc-grpclb:jar:1.30.0:compile
[INFO] |  |     |  \- com.google.protobuf:protobuf-java-util:jar:3.12.0:runtime
[INFO] |  |     \- org.conscrypt:conscrypt-openjdk-uber:jar:2.2.1:compile
[INFO] |  +- io.netty:netty-tcnative-boringssl-static:jar:2.0.26.Final:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.26:compile
[INFO] |  +- com.google.api-ads:google-ads-annotation-processing:jar:9.0.0:compile
[INFO] |  |  \- com.squareup:javapoet:jar:1.11.1:compile
[INFO] |  \- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] +- com.datorama.integrations:common:jar:0.0.1-SNAPSHOT:compile
[INFO] |  +- com.datorama:feature-flag:jar:1.0.12:compile
[INFO] |  |  +- com.launchdarkly:launchdarkly-client:jar:3.0.3:compile
[INFO] |  |  |  +- com.launchdarkly:okhttp-eventsource:jar:1.7.1:compile
[INFO] |  |  |  |  \- com.squareup.okhttp3:okhttp:jar:3.8.1:compile
[INFO] |  |  |  |     \- com.squareup.okio:okio:jar:1.13.0:compile
[INFO] |  |  |  \- redis.clients:jedis:jar:2.9.3:compile
[INFO] |  |  |     \- org.apache.commons:commons-pool2:jar:2.4.3:compile
[INFO] |  |  \- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.8.11:compile
[INFO] |  \- com.restfb:restfb:jar:1.11.0:compile
[INFO] +- com.google.code.gson:gson:jar:2.8.5:compile
[INFO] +- joda-time:joda-time:jar:2.10:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] +- org.springframework:spring-web:jar:4.3.20.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.3.23.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.3.23.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.3.23.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:4.3.23.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:4.3.23.RELEASE:compile
[INFO] +- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.32:compile
[INFO] |  \- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.39:compile
[INFO] |     \- org.apache.tomcat:tomcat-annotations-api:jar:8.5.39:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.10.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.20.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.20.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.5.20.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.20.RELEASE:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.20.RELEASE:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.39:compile
[INFO] |  +- org.hibernate:hibernate-validator:jar:5.3.6.Final:compile
[INFO] |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  |  \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:4.3.23.RELEASE:compile
[INFO] +- org.springframework.cloud:spring-cloud-starter-config:jar:1.4.3.RELEASE:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:1.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-context:jar:1.3.3.RELEASE:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-crypto:jar:4.2.12.RELEASE:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-commons:jar:1.3.3.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.3.RELEASE:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-config-client:jar:1.4.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.5.20.RELEASE:compile
[INFO] |  \- org.springframework.boot:spring-boot-actuator:jar:1.5.20.RELEASE:compile
[INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.60:compile
[INFO] |  \- org.bouncycastle:bcprov-jdk15on:jar:1.60:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.7:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] |  \- log4j:log4j:jar:1.2.17:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.5.20.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test:jar:1.5.20.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.20.RELEASE:test
[INFO]    +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO]    |  \- net.minidev:json-smart:jar:2.2.1:test
[INFO]    |     \- net.minidev:accessors-smart:jar:1.1:test
[INFO]    +- junit:junit:jar:4.12:compile
[INFO]    +- org.assertj:assertj-core:jar:2.6.0:test
[INFO]    +- org.mockito:mockito-core:jar:1.10.19:compile
[INFO]    |  \- org.objenesis:objenesis:jar:2.1:compile
[INFO]    +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO]    +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO]    +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO]    |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO]    \- org.springframework:spring-test:jar:4.3.23.RELEASE:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.031 s
[INFO] Finished at: 2020-10-06T13:19:31+03:00
[INFO] ------------------------------------------------------------------------
nwbirnie commented 3 years ago

It looks like you have quite a few conflicts with the versions required by google-ads-java. In particular I think you should try to override your dependency guava please? It should be com.google.guava:guava:jar:28.2-android:compile.

ashhade commented 3 years ago

after this changing

       <dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>google-ads</artifactId>
            <version>9.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava-jdk5</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>28.2-android</version>
        </dependency>

i get this error

[2020-10-06 14:31:14.070] - 12872 INFO [http-nio-8090-exec-1] --- org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]: Initializing Spring FrameworkServlet 'dispatcherServlet'
[2020-10-06 14:31:14.204] - 12872 SEVERE [http-nio-8090-exec-1] --- org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V] with root cause
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
    at com.google.ads.googleads.lib.catalog.Version.<init>(Version.java:49)
    at com.google.ads.googleads.lib.catalog.VersionCatalog.getCatalog(VersionCatalog.java:28)
    at com.google.ads.googleads.lib.catalog.GeneratedCatalog.<clinit>(GeneratedCatalog.java:269)
    at com.google.ads.googleads.lib.GoogleAdsClient$Builder.build(GoogleAdsClient.java:356)
nwbirnie commented 3 years ago

Can you post the dependency tree after this change please? It looks like you're still getting the wrong version of Guava loaded.

Also can you try to construct a minimum failing example? There's too much in this pom for me to effectively debug it.

ashhade commented 3 years ago

attach it as a file tree.txt

nwbirnie commented 3 years ago

This part looks wrong:

       <dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>google-ads</artifactId>
            <version>9.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava-jdk5</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Your guava-jdk5 dependency comes from com.google.api-client:google-api-client:jar:1.23.0:compile via com.datorama.integrations:basemarket:jar:0.0.1-SNAPSHOT. It could also come from other dependencies which have been hidden due to conflicts. Running mvn dependency:tree -Dverbose should show all the declarations that need to be excluded.

I would suggest setting up a test project with only pom.xml and try removing dependencies until you find one that when removed allows you to construct the client. I would do this by loading the project into Tomcat the same as you're currently doing to see if it actually works on the server.

ashhade commented 3 years ago

`

com.google.guava
        <artifactId>guava</artifactId>
        <version>22.0</version>
    </dependency>`

after using this version it's work fine thanks for the helping