Azure app service: Spring boot application deployment: 500 - The request timed out.

Faisal 1 Reputation point
2020-08-02T12:09:56.693+00:00

I'm trying to deploy my spring boot API application but for some reason it's not working,
it gives me the following error

14984-error.png

I tried the azure plugin and azure devops for deployment and still the same result,
and I even created a simple hello world spring application to see if the problem is related to the app itself,
but it does not as the hello world didn't work either.

I want to see the logs but not still not sure how or where.

this is the current configs for Azure plugin:

<build>   
    <plugins>   
      <plugin>   
        <groupId>com.microsoft.azure</groupId>    
        <artifactId>azure-webapp-maven-plugin</artifactId>    
        <version>1.7.0</version>  
        <configuration>  
          <schemaVersion>V2</schemaVersion>  
          <resourceGroup>Development</resourceGroup>  
          <appName>jamieatna</appName>  
          <pricingTier>F1</pricingTier>  
          <region>southeastasia</region>  
          <runtime>  
            <os>windows</os>  
            <javaVersion>1.8</javaVersion>  
            <webContainer>tomcat 8.5</webContainer>  
          </runtime>  
          <appSettings>  
            <property>  
              <name>JAVA_OPTS</name>  
              <value>-Dserver.port=80</value>  
            </property>  
          </appSettings>  
          <deployment>  
            <resources>  
              <resource>  
                <directory>${project.basedir}/target</directory>  
                <includes>  
                  <include>*.jar</include>  
                </includes>  
              </resource>  
            </resources>  
          </deployment>  
        </configuration>  
      </plugin>   
    </plugins>   
  </build>   

and this is the configs related to Azure build and release pipelines:

trigger:  
- master  
  
pool:  
  vmImage: 'ubuntu-latest'  
  
steps:  
- task: Maven@3  
  inputs:  
    mavenPomFile: 'pom.xml'  
    mavenOptions: '-Xmx3072m'  
    javaHomeOption: 'JDKVersion'  
    jdkVersionOption: '1.8'  
    jdkArchitectureOption: 'x64'  
    publishJUnitResults: true  
    testResultsFiles: '**/surefire-reports/TEST-*.xml'  
    goals: 'package'  
  
- task: CopyFiles@2  
  inputs:  
    SourceFolder: '$(System.DefaultWorkingDirectory)'  
    Contents: '**/*.jar'  
    TargetFolder: '$(build.artifactstagingdirectory)'  
  
- task: PublishBuildArtifacts@1  

14949-prod.png

Any help would be appreciated a lot.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,879 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 26,466 Reputation points Microsoft Employee
    2020-08-03T12:23:30.963+00:00

    Welcome to Microsoft Q&A! Thanks for posting the question.

    1. I understand you have mentioned you have tested with simple hello world app. Kindly ensure that you use mvn package to bulid the JAR package in the directory under which the pom.xml file is located and also make sure that the jar package name configured in web.config is the same as the uploaded jar package name. You can checkout this document for details on the configuration and sample app.
      1. You could inspect the log files from the browser via Kudu.
        https://<yourapp-name>.scm.azurewebsites.net/api/logs/docker.
        https://<yourwebappname.scm.azurewebsites.net/DebugConsole

    To log the stdout and stderr from your container, you need to enable Application Logging under App Service Logs.

    3.To isolate the issue, you may scale-up the App Service Plan and also ensure that "Always-on' settings is enabled on the WebApp.

    4.In the Azure Portal> Navigate to the WebApp> Under “Settings” blade > select ‘Configuration’ > Go to ‘General settings’ > ‘Add Startup Command (Provide an optional startup command that will be run as part of container startup).

    Add the command to start your JAR app (for example, java -jar /home/site/wwwroot/app.jar --server.port=80) >
    These commands or scripts are executed after the built-in Docker container is started, but before your application code is started.

    5.Also, you can configure the amount of time the platform will wait before it restarts your container.

    To do so, set the WEBSITES_CONTAINER_START_TIME_LIMIT app setting to the value you want.
    The default value is 230 seconds, and the maximum value is 1800 seconds.
    To do this, from the Azure Portal> Navigate to your WebApp > Under Settings blade > Go to “Configuration” > Add the above app setting with ‘Name’ with 1800 as ‘Value’.

    Kindly let us know if this helps or you need further assistance.


  2. ajkuma 26,466 Reputation points Microsoft Employee
    2020-09-13T18:19:16.253+00:00

    To benefit the community (just added the offline discussion/solution here)

    Added the “Start Command” that points to the directory of the app.jar.
    Modified pom.xml file to include the code snippet shown below, to resolve the issue.

    24219-image.png

    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.