Google-cloud-java: StreamingPullRequest Missing Method?

Created on 26 Jul 2019  路  5Comments  路  Source: googleapis/google-cloud-java

Hi I am having issues running a simple PubSubStream example locally.

I am getting an error:

Caused by: java.lang.NoSuchMethodError: com.google.pubsub.v1.StreamingPullRequest.emptyIntList()Lcom/google/protobuf/Internal$IntList;
    at com.google.pubsub.v1.StreamingPullRequest.<init>(StreamingPullRequest.java:30)

I think its related to this line:

https://github.com/googleapis/google-cloud-java/blob/master/google-api-grpc/proto-google-cloud-pubsub-v1/src/main/java/com/google/pubsub/v1/StreamingPullRequest.java#L30

Using the google-cloud-pubsub library in Maven:

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-pubsub</artifactId>
  <version>1.84.0</version>
</dependency>

Do you have any ideas?

pubsub question

Most helpful comment

I had the same Issue with 1.88.0 version. The problem was the protobuf version. I was importing the 3.6.1 instead 3.9.1.

All 5 comments

Is the pom file in which you are including this dependency pulling in an protobuf libraries or any other libraries that are pulling in protobuf libraries? If so, I suspect they are pulling in and exposing a version of the library that is incompatible with the version needed by the cloud Pub/Sub library.

This is the dep tree:

PROJECT.processing:jar:1.0-SNAPSHOT
+- com.google.cloud:google-cloud-pubsub:jar:1.84.0:compile
| +- com.google.cloud:google-cloud-core-grpc:jar:1.84.0:compile
| +- com.google.api.grpc:proto-google-cloud-pubsub-v1:jar:1.66.0:compile
| | +- com.google.api:api-common:jar:1.8.1:compile
| | +- com.google.api.grpc:proto-google-iam-v1:jar:0.12.0:compile
| | - javax.annotation:javax.annotation-api:jar:1.3.2:compile
| - com.google.api.grpc:grpc-google-cloud-pubsub-v1:jar:1.66.0:compile
| - io.grpc:grpc-protobuf:jar:1.21.0:compile
| +- io.grpc:grpc-api:jar:1.21.0:compile
| - io.grpc:grpc-protobuf-lite:jar:1.21.0:compile
+- com.github.wnameless:json-flattener:jar:0.6.0:compile
| +- com.eclipsesource.minimal-json:minimal-json:jar:0.9.5:compile
| - org.apache.commons:commons-text:jar:1.4:compile
| - org.apache.commons:commons-lang3:jar:3.7:compile
+- org.apache.beam:beam-sdks-java-core:jar:2.13.0:compile
| +- org.apache.beam:beam-model-pipeline:jar:2.13.0:compile
| | - com.google.errorprone:error_prone_annotations:jar:2.1.2:compile
| +- org.apache.beam:beam-model-job-management:jar:2.13.0:compile
| +- org.apache.beam:beam-vendor-guava-20_0:jar:0.1:compile
| +- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
| +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.8:compile
| +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
| +- org.slf4j:slf4j-api:jar:1.7.25:compile
| +- org.apache.avro:avro:jar:1.8.2:compile
| | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
| | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
| | +- com.thoughtworks.paranamer:paranamer:jar:2.7:compile
| | - org.apache.commons:commons-compress:jar:1.8.1:compile
| +- org.xerial.snappy:snappy-java:jar:1.1.4:compile
| - org.tukaani:xz:jar:1.8:compile
+- org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.13.0:compile
| +- org.apache.beam:beam-sdks-java-extensions-google-cloud-platform-core:jar:2.13.0:compile
| | +- com.google.cloud.bigdataoss:gcsio:jar:1.9.16:compile
| | +- com.google.apis:google-api-services-cloudresourcemanager:jar:v1-rev20181015-1.27.0:compile
| | - com.google.apis:google-api-services-storage:jar:v1-rev20181013-1.27.0:compile
| +- org.apache.beam:beam-sdks-java-extensions-protobuf:jar:2.13.0:compile
| +- io.grpc:grpc-core:jar:1.17.1:compile
| | +- io.grpc:grpc-context:jar:1.17.1:compile
| | +- com.google.code.gson:gson:jar:2.7:compile
| | +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
| | - io.opencensus:opencensus-contrib-grpc-metrics:jar:0.17.0:compile
| +- com.google.api:gax-grpc:jar:1.38.0:compile
| | +- com.google.api:gax:jar:1.38.0:compile
| | +- org.threeten:threetenbp:jar:1.3.3:compile
| | +- io.grpc:grpc-netty-shaded:jar:1.17.1:compile
| | - io.grpc:grpc-alts:jar:1.17.1:compile
| | - io.grpc:grpc-grpclb:jar:1.17.1:runtime
| +- com.google.cloud.bigdataoss:util:jar:1.9.16:compile
| | +- com.google.api-client:google-api-client-java6:jar:1.27.0:compile
| | +- com.google.api-client:google-api-client-jackson2:jar:1.27.0:compile
| | +- com.google.auto.value:auto-value-annotations:jar:1.6.3:compile
| | +- com.google.oauth-client:google-oauth-client-java6:jar:1.27.0:compile
| | +- com.google.flogger:google-extensions:jar:0.3.1:compile
| | | - com.google.flogger:flogger:jar:0.3.1:compile
| | - com.google.flogger:flogger-system-backend:jar:0.3.1:runtime
| +- com.google.cloud.datastore:datastore-v1-proto-client:jar:1.6.0:compile
| | +- com.google.http-client:google-http-client-protobuf:jar:1.20.0:compile
| | - com.google.http-client:google-http-client-jackson:jar:1.20.0:compile
| +- com.google.api.grpc:proto-google-cloud-datastore-v1:jar:0.44.0:compile
| +- io.grpc:grpc-auth:jar:1.17.1:compile
| +- io.grpc:grpc-netty:jar:1.17.1:compile
| | +- io.netty:netty-codec-http2:jar:4.1.30.Final:compile (version selected from constraint [4.1.30.Final,4.1.30.Final])
| | | - io.netty:netty-codec-http:jar:4.1.30.Final:compile
| | - io.netty:netty-handler-proxy:jar:4.1.30.Final:compile
| | - io.netty:netty-codec-socks:jar:4.1.30.Final:compile
| +- io.netty:netty-handler:jar:4.1.30.Final:compile
| | +- io.netty:netty-buffer:jar:4.1.30.Final:compile
| | | - io.netty:netty-common:jar:4.1.30.Final:compile
| | +- io.netty:netty-transport:jar:4.1.30.Final:compile
| | | - io.netty:netty-resolver:jar:4.1.30.Final:compile
| | - io.netty:netty-codec:jar:4.1.30.Final:compile
| +- io.grpc:grpc-stub:jar:1.17.1:compile
| +- com.google.cloud:google-cloud-bigquerystorage:jar:0.79.0-alpha:compile
| | - com.google.api.grpc:grpc-google-cloud-bigquerystorage-v1beta1:jar:0.44.0:compile
| +- com.google.api.grpc:proto-google-cloud-bigquerystorage-v1beta1:jar:0.44.0:compile
| +- com.google.cloud:google-cloud-core:jar:1.61.0:compile
| | - com.google.protobuf:protobuf-java-util:jar:3.6.1:compile
| +- com.google.cloud:google-cloud-spanner:jar:1.6.0:compile
| | +- com.google.api.grpc:proto-google-cloud-spanner-v1:jar:1.6.0:compile
| | +- com.google.api.grpc:proto-google-cloud-spanner-admin-instance-v1:jar:1.6.0:compile
| | +- com.google.api.grpc:grpc-google-cloud-spanner-v1:jar:1.6.0:compile
| | +- com.google.api.grpc:grpc-google-cloud-spanner-admin-database-v1:jar:1.6.0:compile
| | +- com.google.api.grpc:grpc-google-cloud-spanner-admin-instance-v1:jar:1.6.0:compile
| | +- com.google.api.grpc:grpc-google-common-protos:jar:1.12.0:compile
| | - io.opencensus:opencensus-contrib-grpc-util:jar:0.17.0:compile
| +- com.google.api.grpc:grpc-google-cloud-bigtable-v2:jar:0.44.0:compile
| | - com.google.api.grpc:proto-google-cloud-bigtable-v2:jar:0.44.0:compile
| +- com.google.cloud.bigtable:bigtable-client-core:jar:1.8.0:compile
| | +- com.google.cloud:google-cloud-bigtable:jar:0.73.0-alpha:compile
| | +- com.google.cloud:google-cloud-bigtable-admin:jar:0.73.0-alpha:compile
| | +- com.google.api.grpc:proto-google-cloud-bigtable-admin-v2:jar:0.38.0:compile
| | +- com.google.api.grpc:grpc-google-cloud-bigtable-admin-v2:jar:0.38.0:compile
| | +- commons-logging:commons-logging:jar:1.2:compile
| | +- com.google.cloud:google-cloud-core-http:jar:1.55.0:compile
| | | +- com.google.http-client:google-http-client-appengine:jar:1.27.0:compile
| | | - com.google.api:gax-httpjson:jar:0.52.0:compile
| | - io.dropwizard.metrics:metrics-core:jar:3.1.2:compile
| +- com.google.http-client:google-http-client-jackson2:jar:1.27.0:compile
| +- com.google.auth:google-auth-library-credentials:jar:0.12.0:compile
| +- com.google.auth:google-auth-library-oauth2-http:jar:0.12.0:compile
| +- com.google.protobuf:protobuf-java:jar:3.6.0:compile
| +- com.google.api.grpc:proto-google-cloud-spanner-admin-database-v1:jar:1.6.0:compile
| +- com.google.api.grpc:proto-google-common-protos:jar:1.12.0:compile
| +- io.grpc:grpc-all:jar:1.17.1:compile
| | +- io.grpc:grpc-okhttp:jar:1.17.1:compile
| | | +- com.squareup.okhttp:okhttp:jar:2.5.0:compile
| | | - com.squareup.okio:okio:jar:1.13.0:compile
| | +- io.grpc:grpc-protobuf-nano:jar:1.17.1:compile
| | | - com.google.protobuf.nano:protobuf-javanano:jar:3.0.0-alpha-5:compile
| | - io.grpc:grpc-testing:jar:1.17.1:compile
| - io.netty:netty-tcnative-boringssl-static:jar:2.0.17.Final:compile
+- com.google.cloud.bigtable:bigtable-hbase-dataflow:jar:1.5.0:compile
| +- com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:jar:1.9.1:compile
| | +- com.google.apis:google-api-services-dataflow:jar:v1b3-rev43-1.22.0:compile
| | +- com.google.api.grpc:grpc-pubsub-v1:jar:0.0.2:compile
| | | - com.google.api.grpc:grpc-core-proto:jar:0.0.3:compile
| | +- com.google.cloud.bigtable:bigtable-protos:jar:0.3.0:compile
| | +- com.google.apis:google-api-services-clouddebugger:jar:v2-rev8-1.22.0:compile
| | +- com.google.apis:google-api-services-datastore-protobuf:jar:v1beta2-rev1-4.0.0:compile
| | - com.google.cloud.datastore:datastore-v1-protos:jar:1.0.1:compile
| - com.google.cloud.bigtable:bigtable-hbase-1.x-shaded:jar:1.5.0:compile
+- com.google.cloud.bigtable:bigtable-hbase-beam:jar:1.5.0:compile
+- org.apache.beam:beam-sdks-java-io-hbase:jar:2.13.0:compile
| +- org.apache.beam:beam-sdks-java-io-hadoop-common:jar:2.13.0:compile
| - org.apache.hbase:hbase-shaded-client:jar:1.2.6:compile
| +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
| +- org.apache.htrace:htrace-core:jar:3.1.0-incubating:compile
| +- com.github.stephenc.findbugs:findbugs-annotations:jar:1.3.9-1:compile
| - log4j:log4j:jar:1.2.17:compile
+- com.google.api-client:google-api-client:jar:1.30.2:compile
| - com.google.oauth-client:google-oauth-client:jar:1.30.1:compile
+- com.google.apis:google-api-services-bigquery:jar:v2-rev20181104-1.27.0:compile
+- com.google.http-client:google-http-client:jar:1.30.2:compile
| +- org.apache.httpcomponents:httpclient:jar:4.5.8:compile
| | +- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
| | - commons-codec:commons-codec:jar:1.11:compile
| +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
| +- com.google.j2objc:j2objc-annotations:jar:1.3:compile
| +- io.opencensus:opencensus-api:jar:0.21.0:compile
| - io.opencensus:opencensus-contrib-http-util:jar:0.21.0:compile
+- com.google.apis:google-api-services-pubsub:jar:v1-rev425-1.25.0:compile
+- joda-time:joda-time:jar:2.10.1:compile
+- com.google.guava:guava:jar:20.0:compile
+- org.hamcrest:hamcrest-core:jar:2.1:compile
| - org.hamcrest:hamcrest:jar:2.1:compile
+- org.hamcrest:hamcrest-library:jar:2.1:compile
+- junit:junit:jar:4.13-beta-1:compile
+- org.apache.beam:beam-runners-direct-java:jar:2.13.0:test
| +- org.apache.beam:beam-vendor-grpc-1_13_1:jar:0.2:compile
| - args4j:args4j:jar:2.33:test
- org.mockito:mockito-core:jar:1.10.19:test
- org.objenesis:objenesis:jar:2.1:test

I had the same Issue with 1.88.0 version. The problem was the protobuf version. I was importing the 3.6.1 instead 3.9.1.

I have been stuck with this for more than 2 days. Thank you @sabatinim !!! I was having duplicated dependencies.

I think the comment above should solve this issue. Please reopen if it did not.

Was this page helpful?
0 / 5 - 0 ratings