GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unable to run the sample application for google cloud platform · Issue #710 · GoogleCloudPlatform/java-docs-samples

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

New issue
Copy link
New issue
Copy link
Closed
Closed
Unable to run the sample application for google cloud platform#710
Copy link

Description

@architsinha
architsinha
opened on Jun 15, 2017
Issue body actions

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?

Activity

  1. lesv commented on Jun 15, 2017

    @lesv
    lesv
    on Jun 15, 2017
    Contributor
    More actions

    Have you done the following:

    • Install the Cloud SDK followed by:
    gcloud init
    gcloud auth application-default login

    It should pick up the projectID from gcloud.

    Reacted by Luis E. Banegas Saybe and NancyMH
  2. architsinha commented on Jun 16, 2017

    @architsinha
    architsinha
    on Jun 16, 2017
    Author
    More actions

    Thanks a lot, the issue is resolved.
    I had installed the Cloud SDK and run the command
    gcloud init
    However, the command
    gcloud auth application-default login
    was missing. After giving the command I was able to run the app from the PC which was not behind the proxy.
    As regards to the other PC, which is behind the proxy, the issue got resolved after I added the proxy settings in the command, that is:
    mvn -DproxySet=true -DproxyHost=proxy.XXXX.com -DproxyPort=XXXX exec:java -Dexec.mainClass=com.example.storage.QuickstartSample -Dexec.args="my-bucket-name"

  3. architsinha commented on Jun 19, 2017

    @architsinha
    architsinha
    on Jun 19, 2017
    Author
    More actions

    I have an additional query regarding this. I am able to build and run from the command line after following the steps mentioned above.
    However when I try to import and build the project in eclipse (I import it as a maven project), I get the following error in the pom.xml :

    Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (execution: default-compile, phase: compile) pom.xml /datastore-google-cloud-samples line 23 Maven Project Build Lifecycle Mapping Problem

    The details of eclipse I am using are:
    Version: Neon.3 Release (4.6.3)
    Build id: 20170314-1500

    I looked at the following answer: How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds and added the pluginManagement tag in my pom.xml, however I still got the same error.

    Is there any step which I am missing here?
    Is there any particular setting which needs to be done in eclipse to use it with maven and/or google cloud?
    Is there any modification needed in pom.xml for building with eclipse?
    Has anyone else observed this issue?

  4. lesv commented on Jun 19, 2017

    @lesv
    lesv
    on Jun 19, 2017
    Contributor
    More actions

    Are you using Spring?

    Have you changed the pom?

    Are you importing to use w/o maven? (if so, I'm not likely to know the answer), Google Eclipse Plugin

    My quick guess is that you removed the parent pom, and some of our samples can't yet run standalone. You might need to add something from one of the parents.

  5. jabubake commented on Oct 10, 2017

    @jabubake
    jabubake
    on Oct 10, 2017
    Contributor
    More actions

    Can you paste your pluginManagement section here ?

  6. jabubake commented on Apr 3, 2018

    @jabubake
    jabubake
    on Apr 3, 2018
    Contributor
    More actions

    @architsinha Please re-open if you are still running into issues

  7. jabubake
    closed this as completedon Apr 3, 2018
  8. averikitsch
    added 3 commits that reference this issue on Oct 27, 2022

    chore(deps): update dependency com.google.cloud:libraries-bom to v26 (#…

    f236465

    chore(deps): update dependency com.google.cloud:libraries-bom to v26 (#…

    f156ae5

    chore(deps): update dependency com.google.cloud:libraries-bom to v26 (#…

    6369698
  9. minherz
    added 3 commits that reference this issue on Nov 9, 2022

    chore(deps): update dependency com.google.cloud:google-cloud-errorrep…

    05714ce

    chore(deps): update dependency com.google.cloud:google-cloud-errorrep…

    9a47b13

    chore(deps): update dependency com.google.cloud:google-cloud-errorrep…

    2d9fb8c
  10. charlieyu1996
    added a commit that references this issue on Nov 10, 2022

    chore(deps): update dependency com.google.cloud:libraries-bom to v24.…

    f546fc4
  11. Shabirmean
    added 2 commits that reference this issue on Nov 17, 2022

    chore(deps): update dependency com.google.cloud:libraries-bom to v23 (#…

    4d0db97

    chore(deps): update dependency com.google.cloud:libraries-bom to v23 (#…

    e2f258a
  12. charlieyu1996
    added a commit that references this issue on Nov 18, 2022

    merge from main to datacatalog branch (#7449)

    361657a
  13. Shabirmean
    added a commit that references this issue on Nov 18, 2022

    deps: update dependency com.google.cloud:google-cloud-storage to v2.2…

    66a2996
  14. gcf-merge-on-green
    added a commit that references this issue on Dec 20, 2022

    samples: migrate code from googleapis/java-aiplatform (#7451)

    24b693d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.