Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure app service returning 404 for Spring boot Java 8 based war

I am trying to deploy a Springboot based war file on Azure app services and I can see server started in logs but its returning 404 when I try to access website.

Here's what my logs looks like:-

Start up command from app service logs:-

'2022-05-09T22:17:09.766Z INFO  - Starting container for site
2022-05-09T22:17:09.766Z INFO  - docker run -d -p 80:80 --name testing3_0_315c5bf8 -e WEBSITE_SITE_NAME=testing3 -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=testing3.azurewebsites.net -e WEBSITE_INSTANCE_ID=192ae7e12efabd86b8f1992c5d0955e31956c2538c35216038ae1c4c72bce58c -e HTTP_LOGGING_ENABLED=1 -e JAVA_TOOL_OPTIONS=-javaagent:/agents/java/applicationinsights-agent-codeless.jar mcr.microsoft.com/azure-app-service/java:8-jre8_191030025800'

Successful starting logs:-

'2022-05-09 22:19:49.960  INFO 123 --- [main] com.case.client                    : Started testing in 111.231 seconds (JVM running for 138.403)'

I tried to look for it on Stackoverflow and people suggested below things and I tried all of them but nothing is working:

  1. Changing Always On flag to Yes.

  2. Add PORT mapping in config but it didnt help.

  3. Restart app couple of times.

Looks like my request is not reaching my app at all.

Does anyone know what am I doing wrong here?

like image 868
NJin Avatar asked Sep 13 '25 08:09

NJin


1 Answers

I had the same issue with Spring Boot 3. This stack overflow article is 8 month old, because of that it's maybe different problem.

I contacted the Microsoft Support because locally my app runs without any problem. Only in combination with an Azure Web App Service, the application always returns HTTP 404. I deployed the application with the IntelliJ Azure plugin, with maven plugin and with Azure pipeline. No matter which way, the server always returns HTTP 404.

We can see the incoming http request in the Azure Web Service logs, but it is not delivered to the deployed application. But the Spring Boot application is up and running. I downgraded to Spring Boot 2.7.7 and the app runs without any problem on Azure App Service.

The Microsoft Support confirmed the problem with Spring Boot 3 and Azure App Service in combination with codeless Application Insights. The issue will be fixed with the next platform update mid Feb 2023.

The support has provided a workaround: manually install the Application Insights SDK (but we didn't test this yet)

There is no official article for this issue. I thought this might be a good place to announce this problem to help other developers.

like image 160
Linda Avatar answered Sep 14 '25 22:09

Linda