简体   繁体   English

azure 上的 springboot 应用程序服务在启动后立即停止

[英]springboot app on azure app service stops right after start

I have a spring boot rest application on azure app service.我在 azure 应用服务上有一个 spring 启动 rest 应用程序。 Anytime I deploy an application with azure DevOps pipeline or with azure-webapp-maven-plugin directly, the deployment works successfully as I can see all the uploaded files in site/wwwroot/webapps/ROOT from the Kudu Debug Console .每当我使用azure DevOps 管道或直接使用azure-webapp-maven-plugin部署应用程序时,部署都会成功,因为我可以从Kudu Debug Console看到所有上传的文件在site/wwwroot/webapps/ROOT中。 When I try to hit any endpoint or even the application URL, it returns a 404(Not Found error).当我尝试访问任何端点甚至应用程序 URL 时,它会返回 404(未找到错误)。 I pulled up the logs and this is what I find.我拉起日志,这就是我发现的。

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

The application shuts down right after it's initialized.应用程序在初始化后立即关闭。 It looks to me as if the app service is sending a shutdown command to the spring boot application.在我看来,好像应用服务正在向 spring 启动应用程序发送关闭命令。 Can anybody help with this?有人可以帮忙吗? I'm pressed on time.我时间紧迫。 Thanks in advance.提前致谢。

Usually we deploy spring boot app to azure web app by using jar file.通常我们使用 Z68995FCBF432492D150484DZ 应用程序部署 spring 引导应用程序到 azure web 应用程序文件Here are the steps:以下是步骤:

1.Go to your webapp in the portal->Configuration->check the Java container. 1.Go到你的webapp在门户->配置->检查Java容器。 We will use Java SE instead of Tomcat.我们将使用 Java SE 而不是 Tomcat。

在此处输入图像描述

2.Go to your webapp in the portal->Advanced Tools->Debug console->Cmd. 2.Go 在门户网站->高级工具->调试控制台->Cmd中到您的webapp。 Put your jar file under wwwroot folder.将您的 jar 文件放在 wwwroot 文件夹下。 Need to name it as app.jar.需要命名为app.jar。

3.The result 3.结果

在此处输入图像描述

在此处输入图像描述

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM