Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在google app engine上部署spring启动应用程序时出错_Java_Spring_Maven_Google App Engine - Fatal编程技术网

Java 在google app engine上部署spring启动应用程序时出错

Java 在google app engine上部署spring启动应用程序时出错,java,spring,maven,google-app-engine,Java,Spring,Maven,Google App Engine,我的spring boot应用程序在本地计算机上运行良好。但当我尝试使用这个命令在GAE上部署时,它给出了以下错误 mvn appengine:部署 .........................................................failed. [INFO] GCLOUD: ERROR: (gcloud.app.deploy) Error Response: [9] [INFO] GCLOUD: Application startup error: [INFO]

我的spring boot应用程序在本地计算机上运行良好。但当我尝试使用这个命令在GAE上部署时,它给出了以下错误

mvn appengine:部署

.........................................................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>

4.0.0
com.example
演示
0.0.1-快照
罐子
你好,靴子
SpringBoot的演示项目
org.springframework.boot
spring启动程序父级
1.4.2.1发布
UTF-8
UTF-8
1.8
org.springframework.boot
弹簧启动装置
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
弹簧启动启动器数据rest
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧起动试验
测试
org.springframework.boot
spring引导配置处理器
真的
org.springframework.boot
弹簧靴执行器
1.3.3.1发布
mysql
mysql连接器java
com.h2数据库
氢
org.webjars
安格拉斯
1.4.9
运行时
org.webjars
独自创立
3.3.6
运行时
com.google.cloud.tools
appengine maven插件
1.2.1
org.eclipse.jetty
jetty maven插件
9.3.7.v20160115
春假
春假
https://repo.spring.io/libs-release
org.jboss.repository.releases
JBossMaven发布库
https://repository.jboss.org/nexus/content/repositories/releases
春假
春假
https://repo.spring.io/libs-release

知道是什么导致了这个错误以及如何修复它吗?

以防万一其他人有这个问题: 将以下内容添加到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>

org.springframework.boot
springbootmaven插件
2.0.5.1发布
重新包装

这将重新打包jar,以便谷歌可以执行它,以防其他人出现此问题: 将以下内容添加到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>

org.springframework.boot
springbootmaven插件
2.0.5.1发布
重新包装

这将重新打包jar,以便google可以执行它

回答这个老问题:

甚至我在GAE中使用appdeploy命令时也遇到了类似的错误

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 executions中添加重新打包目标

回答这个老问题:

甚至我在GAE中使用appdeploy命令时也遇到了类似的错误

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执行中添加重新打包目标

你能分享你的pom和完整构建输出吗?看起来您正在部署标准jar,而不是springboot的重新打包jar@AndyWilkinson添加了pom.xml代码,您已经注释掉了SpringBoot的Maven插件。你用什么来代替它生成一个可执行的jar?@AndyWilkinson我认为appengine maven插件可以完成这项工作。。如果我错了,请更正。不是根据文档:。SpringBoot的Maven插件是一个更容易使用的组件插件的替代品。您是否共享pom和完整的构建输出?看起来您正在部署标准jar,而不是springboot的重新打包jar@AndyWilkinson添加了pom.xml代码,您已经注释掉了SpringBoot的Maven插件。你用什么来代替它生成一个可执行的jar?@AndyWilkinson我认为appengine maven插件可以完成这项工作。。如果我错了,请更正。不是根据文档:。SpringBoot的Maven插件是汇编插件的一个更易于使用的替代品