简体   繁体   English

Google App Engine上的Spring Boot应用程序:无法找到主类

[英]Spring Boot app on Google App Engine: unable to find main class

I have a Spring Boot app that runs on GCP (for 1 year now) and I would like to update it but when I run mvn appengine:run localy I have this error: 我有一个在GCP上运行的Spring Boot应用程序(至今已有1年),我想对其进行更新,但是当我运行mvn appengine:run localy时出现此错误:

[INFO] GCLOUD: INFOS: javax.servlet.ServletContext log: 2 Spring WebApplicationInitializers detected on classpath
[INFO] GCLOUD: java.lang.IllegalArgumentException: Unable to find the main class to restart
[INFO] GCLOUD:  at org.springframework.util.Assert.notNull(Assert.java:198)
[INFO] GCLOUD:  at org.springframework.boot.devtools.restart.Restarter.doStart(Restarter.java:277)
[INFO] GCLOUD:  at org.springframework.boot.devtools.restart.Restarter.start(Restarter.java:265)
[INFO] GCLOUD:  at org.springframework.boot.devtools.restart.Restarter.lambda$immediateRestart$0(Restarter.java:173)
[INFO] GCLOUD:  at org.springframework.boot.devtools.restart.Restarter$LeakSafeThread.run(Restarter.java:637)
[INFO] GCLOUD: d?c. 02, 2018 4:30:20 PM com.google.appengine.api.datastore.dev.LocalDatastoreService cleanupActiveServices
[INFO] GCLOUD: INFOS: scheduler shutting down.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  53.255 s
[INFO] Finished at: 2018-12-02T17:30:21+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:run (default-cli) on project sample-app: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:run failed: Non zero exit: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:run (default-cli) on project tacos-time29: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:run failed: Non zero exit: 1
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

There is a problem with the main class. 主类有问题。 In my pom.xm I defined this: 在我的pom.xm中,我定义了以下内容:

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <appengine.maven.plugin>1.3.1</appengine.maven.plugin>
    <!--Definition of the main class-->
    <start-class>com.example.sample.Application</start-class>
</properties>

I also defined the main class in the spring-boot-plugin 我还在spring-boot-plugin中定义了主类

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <mainClass>${start-class}</mainClass>
    </configuration>
</plugin>

And the content of /WEB-INF/appengine-web.xml file is basic: /WEB-INF/appengine-web.xml文件的内容是基本的:

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <version>1</version>
    <threadsafe>true</threadsafe>
    <runtime>java8</runtime>
</appengine-web-app>

Thanks for your help 谢谢你的帮助

I found the solution here: https://github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/294 Just remove the devtools dependency. 我在这里找到了解决方案: https : //github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/294只需删除devtools依赖项即可。 It's a really strange behavior 这是很奇怪的行为

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 部署后无法访问Google App Engine中的Spring Boot应用程序 - Unable to access Spring Boot application in Google App Engine after deployment Google APP Engine 和云 sql :: 无法在 Google 云 sql(我的 sql)中连接 Spring boot 应用程序 - Google APP Engine and cloud sql :: Unable to connect Spring boot app in Google cloud sql (my sql) 通过春季启动在Google App Engine中进行Cron作业 - Cron job in Google app engine with spring boot Spring 在 Google Cloud App Engine 上启动托管 - Spring Boot hosting on Google Cloud App Engine 在 Google App Engine 中部署 Spring boot gradle 应用 - Deploy Spring boot gradle app in Google App Engine Google App Engine 上 Spring Boot 应用程序的 Maven 配置文件 - Maven Profile for Spring Boot App on Google App Engine Spring Boot / Maven命令行应用程序:找不到或加载主类 - Spring Boot/ Maven command line app: Could not find or load main class 在 Google Cloud App Engine 上构建 Spring Boot 应用程序的触发器 - Build trigger for Spring Boot application on Google Cloud App Engine 在 Google App Engine 上部署 Spring Boot 应用程序时出错 - Error while deploying spring boot application on google app engine Spring Boot可以在Google标准应用引擎上运行吗? - Can spring boot run on google standard app engine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM