1

https://codelabs.developers.google.com/codelabs/cloud-bookshelf-java-cloud-kms/index.html#0

I'm getting following error after downloading additional Bookshelf app files ( Step 7)

[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.3.8.v20160314:run-exploded (default-cli) on project bookshelf-3: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.3.8.v20160314:run-exploded failed: An API incompatibility was encountered while executing org.eclipse.jetty:jetty-maven-plugin:9.3.8.v20160314:run-exploded: java.lang.NoSuchMethodError: com.google.cloud.ServiceOptions.(Ljava/lang/Class;Ljava/lang/Class;Lcom/google/cloud/ServiceOptions$Builder;Lcom/google/cloud/ServiceDefaults;)

https://codelabs.developers.google.com/codelabs/cloud-bookshelf-java-cloud-kms/index.html#0

KMS KMS
  • 11
  • 1
  • Thanks for the question! We just discovered last week [in this question](https://stackoverflow.com/questions/49393031/error-404-in-url-for-encrypt-with-google-kms/49394263) that this example is using an obsolete version of the API. The current version is v1. We have filed a bug to update the documentation and codelab and I am asking a colleague what the right thing to do is in the meantime. – Tim Dierks Mar 26 '18 at 18:14
  • Thanks so much Tim – KMS KMS Mar 26 '18 at 18:47

1 Answers1

1

like Tim mentioned, you're getting this error because that codelab is currently instructing users to download an older version of the KMS library (v1beta1). You can see this in the pom.xml file in the GCS bucket downloaded, for the google-api-services-cloudkms artifact, whose version is v1beta1-rev1-1.22.0.

To fix the issue, edit the pom.xml file in the bucket to point to the current v1 version, you can find the current version here: https://mvnrepository.com/artifact/com.google.apis/google-api-services-cloudkms. At the time I'm writing this, its v1-rev41-1.23.0.

Current:

<dependency>
  <groupId>com.google.apis</groupId>
  <artifactId>google-api-services-cloudkms</artifactId>
  <version>v1beta1-rev1-1.22.0</version>
</dependency>

Fix

<dependency>
  <groupId>com.google.apis</groupId>
  <artifactId>google-api-services-cloudkms</artifactId>
  <version>v1-rev41-1.23.0</version>
</dependency>

You're also going to need to resolve all of the v1beta1 references inside src/main/java/com/example/getstarted/util/CloudKeyManagementServiceHelper.java

For more information and guides on how to use Google Cloud KMS Java, I'd suggest looking at our java samples.

Thanks

Whiteout
  • 31
  • 3