我的春季启动应用程序在本地计算机上运行良好。但是当我尝试使用此命令在GAE上进行部署时,它会给我以下错误
mvn appengine:deploy
.........................................................failed.
[INFO] GCLOUD: ERROR: (gcloud.app.deploy) Error Response: [9]
[INFO] GCLOUD: Application startup error:
[INFO] GCLOUD: -XX:InitialHeapSize=514850816 -XX:MaxHeapSize=514850816 -XX:+Para
llelRefProcEnabled -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -X
X:+UseCompressedOops -XX:+UseG1GC
[INFO] GCLOUD: openjdk version "1.8.0_121"
[INFO] GCLOUD: OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-1~bpo8+1-b
13)
[INFO] GCLOUD: OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
[INFO] GCLOUD:
[INFO] GCLOUD: no main manifest attribute, in /app/demo-0.0.1-SNAPSHOT.jar
[INFO] GCLOUD:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:35 min
[INFO] Finished at: 2017-04-09T12:13:50+05:30
[INFO] Final Memory: 41M/422M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.2
.1:deploy (default-cli) on project demo: Execution default-cli of goal com.googl
e.cloud.tools:appengine-maven-plugin:1.2.1:deploy failed: Non zero exit: 1 -> [H
elp 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException
[pom.xml中]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>hello-boot</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>1.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>1.4.9</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.6</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.2.1</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
<!--
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
-->
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>org.jboss.repository.releases</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
知道导致此错误的原因以及解决方法吗?
答案 0 :(得分:0)
以防万一其他人遇到此问题: 将以下内容添加到pom.xml:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
这将重新包装jar,以便Google可以执行
答案 1 :(得分:0)
回答这个老问题:
使用appdeploy命令时,即使在GAE中也遇到类似的错误。
2020-02-25T21:33:31Z I0225 21:33:31.690485 40 jvm_internals.cc:130] ClassPathLookup constructor time: 150200 microseconds
2020-02-25T21:33:34Z I0225 21:33:34.075877 40 jvmti_agent.cc:431] Attaching Java debuglet
2020-02-25T21:33:42Z 2020-02-25 21:33:42.791 INFO 1 --- [main] com.company.api.Application : Started Application in 8.904 seconds (JVM running for 11.795)
2020-02-25T21:36:46Z I0225 21:36:46.523680 27 jvmti_globals.cc:327] Build time: May 7 2019 08:21:19
2020-02-25T21:36:46Z I0225 21:36:46.524086 27 jvmti_agent.cc:158] Java debuglet initialization started
2020-02-25T21:36:46Z I0225 21:36:46.524536 27 jvmti_agent.cc:192] Java debuglet initialization completed
2020-02-25T21:36:46Z I0225 21:36:46.674103 27 jvmti_agent.cc:203] Java VM started
2020-02-25T21:36:46Z I0225 21:36:46.689312 27 jvmti_agent.cc:213] JvmtiAgent::JvmtiOnVMInit initialization time: 15208 microseconds
2020-02-25T21:36:46Z I0225 21:36:46.689525 40 jvmti_agent_thread.cc:99] Agent thread started: CloudDebugger_main_worker_thread
2020-02-25T21:36:46Z I0225 21:36:46.689833 40 jvm_internals.cc:374] Loading internals from /opt/cdbg/cdbg_java_agent_internals.jar
2020-02-25T21:36:46Z OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
2020-02-25T21:36:47Z I0225 21:36:47.284777 40 jvm_internals.cc:130] ClassPathLookup constructor time: 162702 microseconds
2020-02-25T21:36:49Z I0225 21:36:49.708652 40 jvmti_agent.cc:431] Attaching Java debuglet
2020-02-25T21:36:58Z 2020-02-25 21:36:58.922 INFO 1 --- [main] com.company.api.Application : Started Application in 9.393 seconds (JVM running r 12.402)
2020-02-25T21:40:08Z I0225 21:40:08.205657 69 jvmti_agent.cc:221] Java VM termination
2020-02-25T21:40:08Z I0225 21:40:08.207619 40 jvmti_agent_thread.cc:103] Agent thread exited: CloudDebugger_main_worker_thread
2020-02-25T21:40:08Z I0225 21:40:08.215693 69 jvmti_agent.cc:235] JvmtiAgent::JvmtiOnVMDeath cleanup time: 10056 microseconds
2020-02-25T21:43:38Z I0225 21:43:38.522686 26 jvmti_globals.cc:327] Build time: May 7 2019 08:21:19
2020-02-25T21:43:38Z I0225 21:43:38.523125 26 jvmti_agent.cc:158] Java debuglet initialization started
2020-02-25T21:43:38Z I0225 21:43:38.523583 26 jvmti_agent.cc:192] Java debuglet initialization completed
2020-02-25T21:43:38Z I0225 21:43:38.682164 26 jvmti_agent.cc:203] Java VM started
2020-02-25T21:43:38Z I0225 21:43:38.699692 26 jvmti_agent.cc:213] JvmtiAgent::JvmtiOnVMInit initialization time: 17520 microseconds
2020-02-25T21:43:38Z I0225 21:43:38.699729 39 jvmti_agent_thread.cc:99] Agent thread started: CloudDebugger_main_worker_thread
2020-02-25T21:43:38Z I0225 21:43:38.700014 39 jvm_internals.cc:374] Loading internals from /opt/cdbg/cdbg_java_agent_internals.jar
2020-02-25T21:43:38Z OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
我做了两件事来解决这个问题:
1 。确保app.yaml文件已指定资源。在某些情况下,VM没有足够的内存来运行应用程序,因此它会关闭。
resources:
cpu: 2
memory_gb: 2.0
2 。就像上述@Roie的答案一样,在Maven执行中添加 repackage 目标