首页 > 解决方案 > spring-boot:在 ctrl-c 后运行失败

问题描述

我正在尝试运行一个 spring-boot 应用程序。但是,以我当前的设置,我不断收到错误。

从 spring-boot 的新版本 2.2.1 开始,我在关闭内置 tomcat 时不断收到相同的错误。

我有一个示例 Spring-Boot 应用程序,我似乎无法正常运行。从 spring initializr 中获取了一个干净的版本。

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.547 s
[INFO] Finished at: 2019-11-07T22:28:54+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.1.RELEASE:run (default-cli) on project java13-app: Application finished with exit code: 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/MojoExecutionException

当我回到 Spring 2.1.10 时,我得到以下输出:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.1.10.RELEASE)
2019-11-07 22:38:33.194  INFO 2572 --- [           main] test.Application                         : Starting Application on DP-BTO-Tom with PID 2572 (Y:\tbrx\java-13-spring-boot\target\classes started by Tom in Y:\tbrx\java-13-spring-boot)
2019-11-07 22:38:33.196  INFO 2572 --- [           main] test.Application                         : No active profile set, falling back to default profiles: default
2019-11-07 22:38:33.966  INFO 2572 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-11-07 22:38:33.986  INFO 2572 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-11-07 22:38:33.986  INFO 2572 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-07 22:38:34.053  INFO 2572 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-11-07 22:38:34.054  INFO 2572 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 832 ms
2019-11-07 22:38:34.221  INFO 2572 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-07 22:38:34.361  INFO 2572 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-07 22:38:34.364  INFO 2572 --- [           main] test.Application                         : Started Application in 1.542 seconds (JVM running for 4.547)
2019-11-07 22:38:35.652  INFO 2572 --- [       Thread-5] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
[Terminate batch job (Y/N)? y

而不是构建失败。

标签: spring-boot

解决方案


作为 Spring Boot - 2.2.1 中的错误询问、修复和关闭

https://github.com/spring-projects/spring-boot/issues/18936#event-2782909196


推荐阅读