gpt4 book ai didi

java - Google App Engine 上的 Spring Boot 应用程序 : unable to find main class

转载 作者:行者123 更新时间:2023-11-29 08:25:29 25 4
gpt4 key购买 nike

我有一个在 GCP 上运行的 Spring Boot 应用程序(现在已经 1 年了),我想更新它,但是当我在本地运行 mvn appengine:run 时,我遇到了这个错误:

[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)

主类有问题。在我的 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>

我还在spring-boot-plugin中定义了主类

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

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

谢谢你的帮助

最佳答案

我在这里找到了解决方案:https://github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/294只需删除 devtools 依赖项。这是一个非常奇怪的行为

关于java - Google App Engine 上的 Spring Boot 应用程序 : unable to find main class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53582515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com