GoogleCloudPlatform/getting-started-java

Cloud storage exception

Closed this issue · 2 comments

Hello all,
i just try to use google cloud storage, but i have a problem.

thats error message

    "status": 500,
    "error": "Internal Server Error",
    "exception": "java.lang.NoSuchMethodError",
    "message": "com.google.cloud.RetryHelper.runWithRetries(Ljava/util/concurrent/Callable;Lcom/google/api/gax/retrying/RetrySettings;Lcom/google/cloud/ExceptionHandler;Lcom/google/api/core/ApiClock;)Ljava/lang/Object;",

Depencies


  <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>google-cloud-storage</artifactId>
            <version>1.2.0</version>
   </dependency>

Source code:

        InputStream originalImage = new URL( "example image url").openStream();
        List<Acl> aclList = Collections.singletonList(Acl.of(Acl.User.ofAllUsers(), Acl.Role.READER));
        Blob blob =
                StorageOptions.getDefaultInstance().getService().create(
                        BlobInfo.newBuilder("bucket-name", name).setAcl(aclList).build(),
                        originalImage);

        String mediaLink = blob.getMediaLink();

App engine yaml:

runtime: java
env: flex

handlers:
- url: /.*
  script: this field is required, but ignored

manual_scaling:
  instances: 1

env_variables:
  BUCKET_NAME: "bucket-name"

runtime_config:
   jdk: openjdk8

health_check:
  enable_health_check: False

Code was deployed to google cloud app engine.
thank you.

lesv commented

Hi,

Just found this, sorry for the delay. I'm presuming you mean this sample or something else?

Looking at the samples they appear to all use 1.3.1, and the latest version is 1.4.0 artifacts. If you are still having an issue try using the latest artifact from maven and the code from the above project.

Hi @lesv,
version 1.4.0 working fine. Thanks.