java - azure应用程序服务上的spring boot应用程序在启动后立即停止

标签 java azure spring-boot azure-web-app-service

我在 azure 应用服务上有一个 Spring Boot Rest 应用程序。每当我使用azure DevOps pipeline或直接使用azure-webapp-maven-plugin部署应用程序时,部署都会成功,因为我可以在中看到所有上传的文件从 Kudu 调试控制台访问 site/wwwroot/webapps/ROOT。当我尝试访问任何端点甚至应用程序 URL 时,它会返回 404(未找到错误)。 我调出了日志,这就是我发现的内容。

[DEBUG] 2020-05-24 10:45:31,644 org.springframework.core.env.PropertySourcesPropertyResolver logKeyFound - - Found key 'spring.liveBeansView.mbeanDomain' in PropertySource 'servletContextInitParams' with value of type String
[INFO] 2020-05-24 10:45:31,660 com.company.product.core.MainApplication logStarted - - Started MainApplication in 37.424 seconds (JVM running for 65.143)
[DEBUG] 2020-05-24 10:45:32,347 org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext doClose - - Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@60d5a711, started on Sun May 24 10:44:58 GMT 2020
[DEBUG] 2020-05-24 10:45:32,378 org.springframework.core.env.PropertySourcesPropertyResolver logKeyFound - - Found key 'spring.liveBeansView.mbeanDomain' in PropertySource 'servletContextInitParams' with value of type String
[DEBUG] 2020-05-24 10:45:32,456 org.springframework.context.support.DefaultLifecycleProcessor stop - - Stopping beans in phase 2147483647
[DEBUG] 2020-05-24 10:45:32,456 org.springframework.context.support.DefaultLifecycleProcessor lambda$doStop$2 - - Bean 'documentationPluginsBootstrapper' completed its stop procedure
[DEBUG] 2020-05-24 10:45:32,456 org.springframework.jmx.export.annotation.AnnotationMBeanExporter destroy - - Unregistering JMX-exposed beans on shutdown
[DEBUG] 2020-05-24 10:45:32,456 org.springframework.jmx.export.annotation.AnnotationMBeanExporter unregisterBeans - - Unregistering JMX-exposed beans
[INFO] 2020-05-24 10:45:32,456 org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor shutdown - - Shutting down ExecutorService 'applicationTaskExecutor'

应用程序在初始化后立即关闭。在我看来,应用程序服务似乎正在向 Spring Boot 应用程序发送关闭命令。 有人可以帮忙吗?我时间紧迫。提前致谢。

最佳答案

通常我们使用jar文件将spring boot应用程序部署到azure web应用程序。步骤如下:

1.转到门户中的Web应用程序->配置->检查Java容器。我们将使用 Java SE 而不是 Tomcat。

enter image description here

2.转到门户中的 Web 应用程序 -> 高级工具 -> 调试控制台 -> Cmd。将您的 jar 文件放在 wwwroot 文件夹下。需要将其命名为app.jar。

3.结果

enter image description here

enter image description here

关于java - azure应用程序服务上的spring boot应用程序在启动后立即停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61989407/

相关文章:

java - 在@SpringBootTest中测试@Async注释的方法

java - 无法从 JavaFX 操作标签

java - 使用 Random.setSeed 的重要性是什么?

Azure SQL Server 添加虚拟网络

Node.JS + SQL Server + MongoDB + 云上的 Redis

azure - azurewebsites.net 上的子域?

java - 将 YAML 文件中的列表映射到对象列表

java - 使用日期和时间戳为每次运行创建 log4j 日志文件

java - 将常规数据保存到文件

java - 如何在 spring-boot 中禁用静态内容句柄?