Skip to content

Unable to run the sample application for google cloud platform #710

Closed
@architsinha

Description

@architsinha

I am just starting off on google-cloud-platform. I have created an account and a project on cloud console. I was trying to run some of the sample apps provided. I started with the sample app for cloud storage provided at:

https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/storage/cloud-client

I have installed apache maven 3.5.0 on my PC. I followed the steps provided in the link, that is I gave the following commands:

mvn clean package -DskipTests
and then

mvn exec:java -Dexec.mainClass=com.example.storage.QuickstartSample -Dexec.args="my-bucket-name"
The first command succeeded. However, the second command failed. I got the following error:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:06 min
[INFO] Finished at: 2017-06-15T18:27:55+05:30
[INFO] Final Memory: 15M/172M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project storage-google-cloud-samples: An exception occured while executing the Java class. connect timed out -> [Help 1]

Now, the computer where I was running this command on, is behind a proxy. However, my proxy settings have been set in the file conf/settings.xml, also when I ran the first command, it successfully downloaded some packages, so I'm not sure if it is due to some proxy issue, however to check, I tried it on another machine, which is not behind a proxy.

I gave the same two commands. The first one succeeded and the second failed again, with the following (different) error:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:02 min
[INFO] Finished at: 2017-06-15T18:22:31+05:30
[INFO] Final Memory: 13M/32M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (d
efault-cli) on project storage-google-cloud-samples: An exception occured while
executing the Java class. 401 Unauthorized -> [Help 1]

So my queries are:

  1. What could be the cause for the error in the first case? Is it something to do with proxy settings? If yes, then where/how should I specify the settings?
  2. What could be the cause for the error in the second case where I am not behind any proxy?
  3. Am i missing some step here?
  4. Also , if you look at the source for this sample app, there is just a single file which basically creates a bucket. The bucket is passed as an argument from command line. Now, as per my understanding, first there needs to a project in the cloud console to create any resources. So where will this bucket be created? As in shouldn't we be specifying the project-ID where this bucket is to be created?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions