2

I have create a web app in Azure app service, when i am tying to access the public url it is giving me 404, even after deploying spring boot application it is giving same response, application is successfully running but not able to access the 404 Error Screen. I have followed below link:

https://learn.microsoft.com/en-us/azure/app-service/quickstart-java?tabs=javase&pivots=platform-windows-development-environment-azure-portal

I have tried all find possible solutions on the internet but no where it is clear.

Karan V
  • 21
  • 1
  • Just checking the basics before we go further, is the app running? What is the current status of the app? – thebernardlim Feb 13 '23 at 08:30
  • yes app is running on local, it is also successfully getting deployed, I can see spring logs on azure as well but when I am opening the URL its showing 404. – Karan V Feb 13 '23 at 22:58
  • Did manage to get a work around for this? Been at it for 2 weeks now... Could use the solution rn. – Wesley Masunika Mar 09 '23 at 07:34

4 Answers4

2

It appears the ApplicationInsights Java Agent that is attached to the jvm is causing the problem.
I don't know exactly why but I'm guessing the default agent jar that is used is not compiled to work with Java 17.

If you have application insights on, try turning them off. Or, you can set the agent jar version (ApplicationInsightsAgent_EXTENSION_VERSION azure web service config prop) to the latest one (3.4.10) and that seems to fix it as well.

See discussion and my reply here: https://github.com/spring-projects/spring-boot/issues/33974#issuecomment-1468484374

bpossolo
  • 849
  • 5
  • 6
  • interesting issue and this solution helped! – noman404 Mar 27 '23 at 10:49
  • In my case was a little bit different, spring boot generates a .war that I could execute with java -jar app.war, but in deployment, I changed their name to app.jar, but this generated the 404 error. – juusechec May 25 '23 at 14:37
1

bpossolo's answer pointed me to a solution that worked in my case. The tomcat version (Tomcat 8.5) that I configured in my Azure web app did not match the embedded Tomcat (Tomcat 10.0) that came with the Spring Web version (3.1.2) that I used.

I no longer got the 404 after I switched the java web server configuration in Azure from Tomcat 8.5 to Tomcat 10.0.

Here's a screenshot of where you can find this in the configuration incase anyone needs it.

SamP
  • 11
  • 3
0
  • Here I deployed a spring boot app in azure app service using the following app service configuration

Runtime Stack - JAVA17

Java web server stack - Java SE (Embedded web server)

Operating System - Windows

  • I deployed my spring boot app using IntelliJ extension for azure as it is my IDE

My spring boot controller:

package com.example.demo;  
  
import org.springframework.web.bind.annotation.GetMapping;  
import org.springframework.web.bind.annotation.RestController;  
  
@RestController  
public class Controller {  
  
    @GetMapping("/Hello")  
    public String api ()  
    {  
        return "Hello World";  
      }  
}

output after deployment :

enter image description here

Mohit Ganorkar
  • 1,917
  • 2
  • 6
  • 11
  • I tried this approach as well, but still, no success, does it has something to do with the student account? and is there a need to define web.confg file in our spring boot application? – Karan V Feb 13 '23 at 23:00
0

After weeks of struggling, googling for solutions and coming up with nothing.

The solution was deploying my Java Springboot api in Azure Spring App.

I still dont know the reason why my app was refusing to run in Azure Web App. Even when the logs stated that the application was successfully.

Unfortunately Azure Spring App are quite pricey to run :(.

Wesley Masunika
  • 153
  • 2
  • 10