Azure web app is returning 404 Error code

Ahtasham Ul Hassan 0 Reputation points
2024-04-12T13:33:08.5833333+00:00

I deployed a spring boot application written in Kotlin with version 3.1.10 on the Azure app service. The app is live, it shows the default page saying, "Your app service is up and running Time to take the next step and deploy your codee," where it shows the Java version and the Tomcat version. I deployed using Terraform.

Deploying the spring boot application with the.jar file used in my cicd.yml automates the whole process, but when I try to reach out to the service, it shows me an error of 404 Not Found.

Runtime Stack Java 17 Tomcat

Does anyone have an idea?

The solution that I have already tried.

  • ApplicationInsight_JAVA_EXTENSION = 3.4.10

Screenshot 2024-04-11 212426

My cicd.yml looks like this:

name: Deploy Microservice to Azure App Service

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Sources
      uses: actions/checkout@v3
    - name: Setup Java
      uses: actions/setup-java@v3
      with:
        distribution: 'temurin'
        java-version: '17'

    - name: Build Project
      run: mvn clean install -DskipTests

    - name: Upload Artifact for Deplyoment Job
      uses: actions/upload-artifact@v2
      with:
        name: microservice
        path: ${{ github.workspace}}/target/*.jar


  deploy:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Download Artifacts from build Job
        uses: actions/download-artifact@v2
        with:
          name: microservice

      - name: Deploy Microservice to Azure App Service
        uses: azure/webapps-deploy@v2
        with:
          app-name: webapp-as-001
          publish-profile: ${{secrets.AZURE_PUBLISH_PROFILE}}
          package: '*.jar'           

Does anyone has any idea, where the issue lies?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Aki Nishikawa 2,455 Reputation points Microsoft Employee
    2024-04-24T04:54:11.65+00:00

    Hello @Ahtasham Ul Hassan,

    Could you please check the following points?

    1. Deploy a war file instead of a jar file when deploying your artifact to Tomcat.
    2. Is your artifact to deploy to Tomcat named "hello.war"?

    Your YAML file looks good to me, but I recommend you try to create GitHub Action YAML file through Deployment Center in Azure Portal. You can find differences between your YAML file (cicd.yml) and auto generated one easily.

    https://learn.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment?tabs=github%2Cgithubactions#configure-the-deployment-source

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.