title: Java KeyManagementServiceClient create hangs in Jruby
body: <p>I have the following block in a java file (GcpEncrypt.java) that runs fine ( unit tests ).</p>
  
  <p>However when I jar it up and call it from within a <code>logstash Jruby input plugin</code>, it hangs at the client create portion. </p>
  
  <pre class="lang-java prettyprint-override"><code>public byte[] decryptWrappedKey(String wrappedKey, String cid)
        throws IOException {
  
      if (this.testMode) { logger.log(Level.INFO, "Decrypting wrapped key");}
  
      byte[] wrappedKeyBytes = Base64.decodeBase64(wrappedKey);
  
      // Create the KeyManagementServiceClient using try-with-resources to manage client cleanup.
      if (this.testMode) { logger.log(Level.INFO, "Creating KMS Client ...");}
      try {
        KeyManagementServiceClient client = KeyManagementServiceClient.create();
        logger.log(Level.INFO, "ENTERED KEY CREATION");
        String keyResourceName = CryptoKeyName.format(
          this.projectId,
          this.locationId,
          this.keyRingId,
          cid);
  
        // Decrypt the ciphertext with Cloud KMS.
        if (this.testMode) { logger.log(Level.INFO, "Decrypting KMS response"); }
        DecryptResponse response = client.decrypt(keyResourceName, ByteString.copyFrom(wrappedKeyBytes));
        if (this.testMode) { logger.log(Level.INFO, "Returning decrypted wraped key"); }
        client.close();
        logger.log(Level.INFO, "**************CLOSING KMS CLIENT ***********");
        return response.getPlaintext().toByteArray();
      }catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  </code></pre>
  
  <p>I can see the <code>ENTERED KEY CREATION</code> log and then it just hangs, how can I go debugging this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I was able to find the relevant by instantiating the <code>KeyManagementServiceClient</code> as an instance variable. It seems the <code>'com.google.cloud', 'google-cloud-kms', '0.81.0-beta'</code> jar is missing the <code>com/google/cloud/kms/v1/ListKeyRingsRequest</code> class.</p>
  
  <pre class="lang-sh prettyprint-override"><code>java.lang.NoClassDefFoundError: com/google/cloud/kms/v1/ListKeyRingsRequest
          at com.google.cloud.kms.v1.stub.GrpcKeyManagementServiceStub.&lt;clinit&gt;(com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceStub.java:88)
          at com.google.cloud.kms.v1.stub.KeyManagementServiceStubSettings.createStub(com/google/cloud/kms/v1/stub/KeyManagementServiceStubSetting
  s.java:292)
          at com.google.cloud.kms.v1.KeyManagementServiceClient.&lt;init&gt;(com/google/cloud/kms/v1/KeyManagementServiceClient.java:154)
          at com.google.cloud.kms.v1.KeyManagementServiceClient.create(com/google/cloud/kms/v1/KeyManagementServiceClient.java:135)
          at com.google.cloud.kms.v1.KeyManagementServiceClient.create(com/google/cloud/kms/v1/KeyManagementServiceClient.java:126)
  
  </code></pre>