0
votes

I have a spring boot rest application on azure app service. 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. When I try to hit any endpoint or even the application URL, it returns a 404(Not Found error). 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. Can anybody help with this? I'm pressed on time. Thanks in advance.

1
It's difficult to say anything without seeing the code. Does your app run and proceed requests if started on local mashine?Sergej Masljukow
Yes please, it runs on my local machineEmmanuel Sarpong
Can you try packing the SpringBoot app as a JAR (which has embedded Tomcat). Name it app.jar and place it under D:\home\site\wwwroot folder of the WebApp. You can upload it directly via the Kudu site. Remove web.config, if any.Gaurav Kumar
If the answer is helpful for you, you can accept it as answer. Thank you.Tony Ju

1 Answers

0
votes

Usually we deploy spring boot app to azure web app by using jar file. Here are the steps:

1.Go to your webapp in the portal->Configuration->check the Java container. We will use Java SE instead of Tomcat.

enter image description here

2.Go to your webapp in the portal->Advanced Tools->Debug console->Cmd. Put your jar file under wwwroot folder. Need to name it as app.jar.

3.The result

enter image description here

enter image description here