GoogleCloudPlatform/getting-started-java

mvn appengine:deploy failing to deploy app

cdharma opened this issue · 6 comments

Hi

I am able to successfully test the getting started java app locally with : mvn appengine:run but when i deploy with mvn appengine:deploy it fails with "Non zero exit : 1" error.

~/gcp/demo/getting-started-java/appengine-standard-java8/helloworld $ mvn appengine:deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> appengine-maven-plugin:1.3.1:deploy (default-cli) > package @ helloworld >>>
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:prepare-agent (default) @ helloworld ---
[INFO] argLine set to -javaagent:/Users/chetandharma/.m2/repository/org/jacoco/org.jacoco.agent/0.7.9/org.jacoco.agent-0.7.9-runtime.jar=destfile=/Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- versions-maven-plugin:2.3:display-dependency-updates (default) @ helloworld ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO] junit:junit ................................ 4.12 -> 4.12.0.redhat-003
[INFO]
[INFO] The following dependencies in Dependencies have newer versions:
[INFO] javax.servlet:javax.servlet-api ....................... 3.1.0 -> 4.0.0
[INFO]
[INFO]
[INFO] --- versions-maven-plugin:2.3:display-plugin-updates (default) @ helloworld ---
[INFO]
[INFO] The following plugin updates are available:
[INFO] com.google.cloud.tools:appengine-maven-plugin ........ 1.3.1 -> 1.3.2
[INFO]
[INFO] All plugins have a version specified.
[INFO]
[INFO] Project inherits minimum Maven version as: 3.5.0
[INFO] Plugins require minimum Maven version of: 2.0
[INFO]
[INFO] No plugins require a newer version of Maven than specified by the pom.
[INFO]
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ helloworld ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.appengine.java8.HelloAppEngineTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3 s - in com.example.appengine.java8.HelloAppEngineTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:report (report) @ helloworld ---
[INFO] Loading execution data file /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/jacoco.exec
[INFO] Analyzed bundle 'helloworld' with 1 classes
[INFO]
[INFO] --- maven-war-plugin:3.1.0:war (default-war) @ helloworld ---
[INFO] Packaging webapp
[INFO] Assembling webapp [helloworld] in [/Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/helloworld-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/src/main/webapp]
[INFO] Webapp assembled in [103 msecs]
[INFO] Building war: /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/helloworld-1.0-SNAPSHOT.war
[INFO]
[INFO] <<< appengine-maven-plugin:1.3.1:deploy (default-cli) < package @ helloworld <<<
[INFO]
[INFO]
[INFO] --- appengine-maven-plugin:1.3.1:deploy (default-cli) @ helloworld ---
[INFO] Deleting the staging directory: /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/appengine-staging
[INFO] Staging the application to: /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/appengine-staging
[INFO] Detected App Engine standard environment application.
Mar 05, 2018 9:20:58 PM com.google.cloud.tools.appengine.cloudsdk.CloudSdk logCommand
INFO: submitting command: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -cp /Users/chetandharma/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/lib/appengine-tools-api.jar com.google.appengine.tools.admin.AppCfg --disable_update_check stage /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/helloworld-1.0-SNAPSHOT /Users/chetandharma/GCP/demo/getting-started-java/appengine-standard-java8/helloworld/target/appengine-staging
[INFO] GCLOUD: Reading application configuration data...
[INFO] GCLOUD:
[INFO] GCLOUD:
[INFO] GCLOUD: Beginning interaction for module default...
[INFO] GCLOUD: 0% Scanning for jsp files.
[INFO] GCLOUD: 0% Compiling jsp files.
[INFO] GCLOUD: Mar 05, 2018 9:21:02 PM org.apache.jasper.servlet.TldScanner scanJars
[INFO] GCLOUD: INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[INFO] GCLOUD: Mar 05, 2018 9:21:02 PM org.apache.jasper.JspC processFile
[INFO] GCLOUD: INFO: Built File: /index.jsp
[INFO] GCLOUD: Unable to stage app: Cannot get the System Java Compiler. Please use a JDK, not a JRE.
[INFO] GCLOUD: Please see the logs [/var/folders/fm/bmx3jt8153z73mk7dxp0c2v40000gn/T/appcfg1631547678768954396.log] for further information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.974 s
[INFO] Finished at: 2018-03-05T21:21:02+05:30
[INFO] Final Memory: 23M/317M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:deploy (default-cli) on project helloworld: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:deploy failed: Non zero exit: 1 -> [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/PluginExecutionException
~/gcp/demo/getting-started-java/appengine-standard-java8/helloworld $

Here is my gcloud information and mvn version:
~/gcp/demo/getting-started-java/appengine-standard-java8/helloworld $ gcloud info
Google Cloud SDK [191.0.0]

Platform: [Mac OS X, x86_64] ('Darwin', 'Chetans-MacBook-Pro.local', '17.3.0', 'Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64', 'x86_64', 'i386')
Python Version: [2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 12:54:16) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]]
Python Location: [/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python]
Site Packages: [Disabled]

Installation Root: [/Users/chetandharma/google-cloud-sdk]
Installed Components:
core: [2018.02.23]
app-engine-python: [1.9.67]
gsutil: [4.28]
app-engine-java: [1.9.62]
bq: [2.0.29]

~/gcp/demo/getting-started-java/appengine-standard-java8/helloworld $ mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T01:09:06+05:30)
Maven home: /Users/chetandharma/soft/apache-maven-3.5.0
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"

lesv commented

env | grep JAVA
JAVA_HOME=/Library/Java/JavaVirtualMachines/default/Contents/Home is what I'd expect.

Not sure why it has JavaAppletPlugin as yours.

My .bash_profile has the following in it:

  export JAVA_HOME=$(/usr/libexec/java_home -v $1)
  export PATH=$JAVA_HOME/bin:$BASEPATH

Where $1 is set to 1.8 usually.

i found some error with imports
change the file
servletInitializer.java

this import org.springframework.boot.web.support.SpringBootServletInitializer;
to
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@jordanks you are right. Thanks for replying. I was able to make this change and deploy the app successfully.

related #375

Probably an issue with your JAVA_HOME env variable. Here is some additional information: https://stackoverflow.com/questions/15985363/cannot-get-the-system-java-compiler-please-use-a-jdk-not-a-jre