googleapis / java-bigquerystorage

Apache License 2.0
60 stars 80 forks source link

java.lang.NoSuchMethodError: org.json.JSONObject.getNames(Lorg/json/JSONObject;)[Ljava/lang/String #1420

Closed mohan-ganesh closed 2 years ago

mohan-ganesh commented 2 years ago

JDK 1.8 or 11 , the BigQuery Client seems to throw this java.lang.NoSuchMethodError: org.json.JSONObject.getNames(Lorg/json/JSONObject;)[Ljava/lang/String , but still data is being persisted.

mvn dependency tree:

[INFO] Building speechtotext 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-dependency-plugin:3.1.2:tree (default-cli) @ speechtotext --- [INFO] com.highmarkhealth.diginn:speechtotext:jar:0.0.1-SNAPSHOT [INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.4.4:compile [INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.4.4:compile [INFO] | | +- org.springframework.boot:spring-boot:jar:2.4.4:compile [INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.4.4:compile [INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.4.4:compile [INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile [INFO] | | | | - ch.qos.logback:logback-core:jar:1.2.3:compile [INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile [INFO] | | | | - org.apache.logging.log4j:log4j-api:jar:2.13.3:compile [INFO] | | | - org.slf4j:jul-to-slf4j:jar:1.7.30:compile [INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile [INFO] | | - org.yaml:snakeyaml:jar:1.27:compile [INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.4.4:compile [INFO] | | +- org.springframework.boot:spring-boot-actuator:jar:2.4.4:compile [INFO] | | - com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.4:compile [INFO] | - io.micrometer:micrometer-core:jar:1.6.5:compile [INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile [INFO] | - org.latencyutils:LatencyUtils:jar:2.0.3:runtime [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.4.4:compile [INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.4.4:compile [INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.4:compile [INFO] | | - com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.4:compile [INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.4.4:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.44:compile [INFO] | | +- org.glassfish:jakarta.el:jar:3.0.3:compile [INFO] | | - org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.44:compile [INFO] | +- org.springframework:spring-web:jar:5.3.5:compile [INFO] | | - org.springframework:spring-beans:jar:5.3.5:compile [INFO] | - org.springframework:spring-webmvc:jar:5.3.5:compile [INFO] | +- org.springframework:spring-aop:jar:5.3.5:compile [INFO] | +- org.springframework:spring-context:jar:5.3.5:compile [INFO] | - org.springframework:spring-expression:jar:5.3.5:compile [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.4.4:test [INFO] | +- org.springframework.boot:spring-boot-test:jar:2.4.4:test [INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.4.4:test [INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test [INFO] | | - net.minidev:json-smart:jar:2.3:test [INFO] | | - net.minidev:accessors-smart:jar:1.2:test [INFO] | | - org.ow2.asm:asm:jar:5.0.4:test [INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test [INFO] | | - jakarta.activation:jakarta.activation-api:jar:1.2.2:test [INFO] | +- org.assertj:assertj-core:jar:3.18.1:test [INFO] | +- org.hamcrest:hamcrest:jar:2.2:test [INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.7.1:test [INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.7.1:test [INFO] | | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test [INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test [INFO] | | | - org.junit.platform:junit-platform-commons:jar:1.7.1:test [INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.7.1:test [INFO] | | - org.junit.jupiter:junit-jupiter-engine:jar:5.7.1:test [INFO] | | - org.junit.platform:junit-platform-engine:jar:1.7.1:test [INFO] | +- org.mockito:mockito-core:jar:3.6.28:test [INFO] | | +- net.bytebuddy:byte-buddy:jar:1.10.22:test [INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.10.22:test [INFO] | | - org.objenesis:objenesis:jar:3.1:test [INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.6.28:test [INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test [INFO] | | - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test [INFO] | +- org.springframework:spring-core:jar:5.3.5:compile [INFO] | | - org.springframework:spring-jcl:jar:5.3.5:compile [INFO] | +- org.springframework:spring-test:jar:5.3.5:test [INFO] | - org.xmlunit:xmlunit-core:jar:2.7.0:test [INFO] +- com.google.cloud:google-cloud-speech:jar:1.27.0:compile [INFO] | +- com.google.api.grpc:proto-google-cloud-speech-v1p1beta1:jar:0.85.2:compile [INFO] | +- com.google.api.grpc:proto-google-cloud-speech-v1:jar:2.1.2:compile [INFO] | +- com.google.api:api-common:jar:2.0.5:compile [INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile [INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile [INFO] | +- com.google.auto.value:auto-value-annotations:jar:1.8.2:compile [INFO] | +- com.google.guava:guava:jar:31.0.1-jre:compile [INFO] | +- com.google.guava:failureaccess:jar:1.0.1:compile [INFO] | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile [INFO] | +- org.checkerframework:checker-compat-qual:jar:2.5.5:compile [INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.5.1:compile [INFO] | +- com.google.j2objc:j2objc-annotations:jar:1.3:compile [INFO] | +- io.grpc:grpc-api:jar:1.41.0:compile [INFO] | +- io.grpc:grpc-context:jar:1.41.0:compile [INFO] | +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.20:runtime [INFO] | +- io.grpc:grpc-stub:jar:1.41.0:compile [INFO] | +- io.grpc:grpc-protobuf:jar:1.41.0:compile [INFO] | +- io.grpc:grpc-protobuf-lite:jar:1.41.0:compile [INFO] | +- com.google.protobuf:protobuf-java:jar:3.18.1:compile [INFO] | +- com.google.api.grpc:proto-google-common-protos:jar:2.6.0:compile [INFO] | +- com.google.api:gax:jar:2.6.1:compile [INFO] | +- com.google.auth:google-auth-library-oauth2-http:jar:1.2.1:compile [INFO] | +- com.google.http-client:google-http-client:jar:1.40.1:compile [INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile [INFO] | +- commons-logging:commons-logging:jar:1.2:compile [INFO] | +- commons-codec:commons-codec:jar:1.15:compile [INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.14:compile [INFO] | +- io.opencensus:opencensus-contrib-http-util:jar:0.28.0:compile [INFO] | +- com.google.http-client:google-http-client-gson:jar:1.40.1:compile [INFO] | +- com.google.code.gson:gson:jar:2.8.6:compile [INFO] | +- io.opencensus:opencensus-api:jar:0.28.0:compile [INFO] | +- com.google.api:gax-grpc:jar:2.6.1:compile [INFO] | +- io.grpc:grpc-auth:jar:1.41.0:compile [INFO] | +- com.google.auth:google-auth-library-credentials:jar:1.2.1:compile [INFO] | +- io.grpc:grpc-netty-shaded:jar:1.41.0:compile [INFO] | +- io.grpc:grpc-core:jar:1.41.0:compile [INFO] | +- com.google.android:annotations:jar:4.1.1.4:runtime [INFO] | +- io.perfmark:perfmark-api:jar:0.23.0:runtime [INFO] | +- io.grpc:grpc-alts:jar:1.41.0:compile [INFO] | +- io.grpc:grpc-grpclb:jar:1.41.0:compile [INFO] | +- com.google.protobuf:protobuf-java-util:jar:3.18.1:compile [INFO] | +- org.conscrypt:conscrypt-openjdk-uber:jar:2.5.1:compile [INFO] | - org.threeten:threetenbp:jar:1.5.0:compile [INFO] +- org.springdoc:springdoc-openapi-ui:jar:1.2.34:compile [INFO] | +- org.springdoc:springdoc-openapi-webmvc-core:jar:1.2.34:compile [INFO] | | - org.springdoc:springdoc-openapi-common:jar:1.2.34:compile [INFO] | | +- io.swagger.core.v3:swagger-models:jar:2.1.1:compile [INFO] | | +- io.swagger.core.v3:swagger-annotations:jar:2.1.1:compile [INFO] | | +- io.swagger.core.v3:swagger-integration:jar:2.1.1:compile [INFO] | | | - io.swagger.core.v3:swagger-core:jar:2.1.1:compile [INFO] | | | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile [INFO] | | | | - javax.activation:javax.activation-api:jar:1.2.0:compile [INFO] | | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.11.4:compile [INFO] | | | - javax.validation:validation-api:jar:2.0.1.Final:compile [INFO] | | - io.github.classgraph:classgraph:jar:4.8.44:compile [INFO] | +- org.webjars:swagger-ui:jar:3.25.0:compile [INFO] | - org.webjars:webjars-locator:jar:0.38:compile [INFO] | +- org.webjars:webjars-locator-core:jar:0.46:compile [INFO] | - org.apache.commons:commons-lang3:jar:3.11:compile [INFO] +- com.google.cloud:google-cloud-bigquerystorage:jar:2.4.2:compile [INFO] | +- com.google.api.grpc:proto-google-cloud-bigquerystorage-v1beta1:jar:0.128.2:compile [INFO] | +- com.google.api.grpc:proto-google-cloud-bigquerystorage-v1beta2:jar:0.128.2:compile [INFO] | +- com.google.api.grpc:proto-google-cloud-bigquerystorage-v1:jar:2.4.2:compile [INFO] | +- org.checkerframework:checker-qual:jar:3.12.0:compile [INFO] | +- org.json:json:jar:20200518:compile [INFO] | +- com.google.cloud:google-cloud-core:jar:2.2.0:compile [INFO] | +- com.google.api.grpc:proto-google-iam-v1:jar:1.1.6:compile [INFO] | +- com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1beta1:jar:0.128.2:compile [INFO] | +- com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1beta2:jar:0.128.2:compile [INFO] | - com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1:jar:2.4.2:compile [INFO] +- com.google.cloud:google-cloud-bigquery:jar:2.4.1:compile [INFO] | +- com.google.cloud:google-cloud-core-http:jar:2.2.0:compile [INFO] | +- com.google.api-client:google-api-client:jar:1.32.2:compile [INFO] | +- com.google.oauth-client:google-oauth-client:jar:1.32.1:compile [INFO] | +- com.google.http-client:google-http-client-apache-v2:jar:1.40.1:compile [INFO] | +- com.google.http-client:google-http-client-appengine:jar:1.40.1:compile [INFO] | +- com.google.api:gax-httpjson:jar:0.91.1:compile [INFO] | +- com.google.http-client:google-http-client-jackson2:jar:1.40.1:compile [INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.11.4:compile [INFO] | - com.google.apis:google-api-services-bigquery:jar:v2-rev20211106-1.32.1:compile [INFO] +- org.apache.avro:avro:jar:1.11.0:compile [INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.4:compile [INFO] | +- org.apache.commons:commons-compress:jar:1.21:compile [INFO] | - org.slf4j:slf4j-api:jar:1.7.30:compile [INFO] +- org.apache.arrow:arrow-vector:jar:6.0.0:compile [INFO] | +- org.apache.arrow:arrow-format:jar:6.0.0:compile [INFO] | +- org.apache.arrow:arrow-memory-core:jar:6.0.0:compile [INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.4:compile [INFO] | +- io.netty:netty-common:jar:4.1.60.Final:compile [INFO] | - com.google.flatbuffers:flatbuffers-java:jar:1.12.0:compile [INFO] +- org.apache.arrow:arrow-memory-netty:jar:6.0.0:compile [INFO] | - io.netty:netty-buffer:jar:4.1.60.Final:compile [INFO] - junit:junit:jar:4.13.2:test [INFO] - org.hamcrest:hamcrest-core:jar:2.2:test [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.320 s [INFO] Finished at: 2021-11-19T09:37:32-05:00 [INFO] ------------------------------------------------------------------------


#### Stack trace

java.lang.NoSuchMethodError: org.json.JSONObject.getNames(Lorg/json/JSONObject;)[Ljava/lang/String;

stephaniewang526 commented 2 years ago

Hi, the client library builds successfully without this issue. Please check your project pom file and make sure dependencies are correctly included.

mohan-ganesh commented 2 years ago

sorry - i agree that dependnacy of the issue is stemming from org.springframework.boot:spring-boot-starter-test:jar which is loading older version of JSONObject.class

repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class

+- org.springframework.boot:spring-boot-starter-test:jar:2.4.4:test [INFO] | +- org.springframework.boot:spring-boot-test:jar:2.4.4:test [INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.4.4:test [INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test [INFO] | | - net.minidev:json-smart:jar:2.3:test [INFO] | | - net.minidev:accessors-smart:jar:1.2:test [INFO] | | - org.ow2.asm:asm:jar:5.0.4:test [INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test [INFO] | | - jakarta.activation:jakarta.activation-api:jar:1.2.2:test [INFO] | +- org.assertj:assertj-core:jar:3.18.1:test [INFO] | +- org.hamcrest:hamcrest:jar:2.2:test [INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.7.1:test [INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.7.1:test [INFO] | | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test [INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test [INFO] | | | - org.junit.platform:junit-platform-commons:jar:1.7.1:test [INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.7.1:test [INFO] | | - org.junit.jupiter:junit-jupiter-engine:jar:5.7.1:test [INFO] | | - org.junit.platform:junit-platform-engine:jar:1.7.1:test [INFO] | +- org.mockito:mockito-core:jar:3.6.28:test [INFO] | | +- net.bytebuddy:byte-buddy:jar:1.10.22:test [INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.10.22:test [INFO] | | - org.objenesis:objenesis:jar:3.1:test [INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.6.28:test [INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test [INFO] | | - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test