Search code examples
javamavengoogle-app-enginegoogle-cloud-platformgoogle-managed-vm

Sample project “hello-world” project is showing ERROR while trying to run on App engine


I am trying to deploy the "Hello, World!" for Java on App engine for Managed VMs Java 8 and facing the below listed error while running mvn gcloud:deploy. I did not face any issue while running it on my local machine (mvn jetty:run). Can someone please point me on what am I doing wrong?

[INFO] Building war: C:\Users\krajendran\AppData\Local\Google\Cloud SDK\java-docs-samples\managed_vms\helloworld\target\managedvms-helloworld-mvm-1.0-SNAPSHOT.war
[INFO]
[INFO] <<< gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) < package @ managedvms-helloworld-mvm <<<
[INFO]
[INFO] --- gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) @ managedvms-helloworld-mvm ---
[INFO] Running gcloud app deploy...
[INFO] Running python.exe -S C:\Users\krajendran\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\gcloud.py --quiet preview app deploy C:\Users\krajendran\AppData\Local\Google\Cloud SDK\java-docs-samples\managed_vms\helloworld\target\appengine-staging/app.yaml --promote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.340 s
[INFO] Finished at: 2016-02-28T21:37:22-05:00
[INFO] Final Memory: 18M/226M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) on project managedvms-helloworld-mvm: Could not start the dev app server: Cannot run program "python.exe" (in directory "C:\Users\krajendran\AppData\Local\Google\Cloud SDK\java-docs-samples\managed_vms\helloworld\target\appengine-staging"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Please find the complete log after adding -X to maven execution

[ERROR] Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) on project managedvms-helloworld-mvm: Could not start the dev app server: Cannot run program "python.exe" (in directory "C:\Users\krajendran\AppData\Local\Google\Cloud SDK\java-docs-samples\managed_vms\helloworld\target\appengine-staging"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) on project managedvms-helloworld-mvm: Could not start the dev app server
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not start the dev app server
        at com.google.appengine.gcloudapp.AbstractGcloudMojo.startCommand(AbstractGcloudMojo.java:472)
        at com.google.appengine.gcloudapp.GCloudAppDeploy.execute(GCloudAppDeploy.java:43)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.io.IOException: Cannot run program "python.exe" (in directory "C:\Users\krajendran\AppData\Local\Google\Cloud SDK\java-docs-samples\managed_vms\helloworld\target\appengine-staging"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at com.google.appengine.gcloudapp.AbstractGcloudMojo.startCommand(AbstractGcloudMojo.java:392)
        ... 23 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 24 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

After installing Python and adding it to my PATH, I am getting the below exception:

[ERROR] Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) on project managedvms-helloworld-mvm: Error: gcloud app command exit code is: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.95.v20160203:deploy (default-cli) on project managedvms-helloworld-mvm: Error: gcloud app command exit code is: 1
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error: gcloud app command exit code is: 1
        at com.google.appengine.gcloudapp.AbstractGcloudMojo.startCommand(AbstractGcloudMojo.java:463)
        at com.google.appengine.gcloudapp.GCloudAppDeploy.execute(GCloudAppDeploy.java:43)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
[INFO]   File "C:\Users\krajendran\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\gcloud.py", line 53, in <module>
[ERROR]
[ERROR]
[INFO]     main()
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO]   File "C:\Users\krajendran\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\gcloud.py", line 31, in main
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO]     import googlecloudsdk.gcloud_main
[INFO]   File "C:\Users\krajendran\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\gcloud_main.py", line 25, in <module>
[INFO]     import signal
[INFO]   File "C:\Users\krajendran\AppData\Local\Programs\Python\Python35\lib\signal.py", line 8, in <module>
[INFO]     _IntEnum._convert(
[INFO]   File "C:\Users\krajendran\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\third_party\enum\__init__.py", line 366, in __getattr__

Solution

  • As mentioned installing Python and adding it to path did not help. I followed two things to make it work:

    Followed the link to add .PY extension to PATHEXT variable and edited PATH to add gcould - C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\gcloud

    Also edited PATH to include Python path that came bundled with the google SDK - C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython;

    I then ran into issue with Google SDK location which was solved by adding the configuration to my POM.xml:

    <plugins>
          <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>gcloud-maven-plugin</artifactId>
            <version>2.0.9.95.v20160203</version>
            <configuration>
                <gcloud_directory>C:/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk</gcloud_directory>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
              <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
          </plugin>