I use Cloud Datastore API to check for Kinds in the Datastore, then  use
Dataflow -- now upgrading to Beam -- to copy one Datastore to another..

After adding beam-sdks-java-io-google-cloud-platform to my pom, I start
getting this when initializing the Cloud Datastore API

Exception in thread "main" java.lang.NoClassDefFoundError:
com/google/api/gax/retrying/ResultRetryAlgorithm
at com.google.cloud.datastore.DatastoreOptions$DefaultDatastoreFactory.
create(DatastoreOptions.java:51)
at com.google.cloud.datastore.DatastoreOptions$DefaultDatastoreFactory.
create(DatastoreOptions.java:45)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:426)

It is caused by  gax dependencies.

Specifically, before I add beam-sdks-java-io-google-cloud-platform there is
this  gax dependency

+- com.google.cloud:google-cloud-datastore:jar:1.12.0:compile
|  +- com.google.cloud:google-cloud-core:jar:1.12.0:compile
|  |  +- com.google.api:gax:jar:1.15.0:compile



and after I add  it there is this

+- org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.2.0:compile
|  +- com.google.api:gax-grpc:jar:0.20.0:compile
|  |  +- com.google.api:gax:jar:1.3.1:compile


If I add gax 1.15.0 to my pom explicitly, I get

Exception in thread "main" java.lang.NoClassDefFoundError:
com/google/api/gax/retrying/ExceptionRetryAlgorithm
at java.lang.ClassLoader.defineClass1(Native Method)
..
at com.google.cloud.BaseService.<clinit>(BaseService.java:48)
at
com.google.cloud.datastore.DatastoreOptions$DefaultDatastoreFactory.create(DatastoreOptions.java:51)
at
com.google.cloud.datastore.DatastoreOptions$DefaultDatastoreFactory.create(DatastoreOptions.java:45)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:426)

Clearly Datastore and Beam should work together. Yet there have been
dependency problems between the two for  a while. See this discussion
<https://stackoverflow.com/questions/40830727/> from 1 year ago.

How can I resolve this?

Reply via email to