deploy to Azure Web App(GSHFLCSpringApiDev) with resource creation or updating: Status code 400, (empty body)

Anonymous
2023-09-13T02:13:44.51+00:00

I am trying to deploy my SpringAPI to Azure Web App using Azure Maven Plugin but I am getting this Error

Failed to execute goal com.microsoft.azure:azure-webapp-maven-plugin:2.12.0:deploy (default-cli) on project demo: deploy to Azure Web App with resource creation or updating: AzureToolkitRuntimeException: deploy to Azure Web App(GSHFLCSpringApiDev) with resource creation or updating: Status code 400, (empty body) -> [Help 1]

[WARNING] 'Content-Type' not found. Returning default encoding: JSON

[ERROR] Status code 400, (empty body)

2023-09-15T01:32:34.370569183Z: [INFO]  __COM_MICROSOFT_AZURE_APPSERVICE_JARENTRYPOINT_PREFIX____COM_MICROSOFT_AZURE_APPSERVICE_JARENTRYPOINT_SUFFIX__
2023-09-15T01:32:34.437610191Z: [INFO]  Extracted jar entry point. Class name is: ''
2023-09-15T01:32:34.450039049Z: [INFO]  Defaulting to UTF-8
2023-09-15T01:32:34.450393579Z: [INFO]  Failed to query jar entry point. Falling back to legacy command-line
2023-09-15T01:32:34.451472271Z: [INFO]  Running command: java -Djava.util.logging.config.file=/usr/local/appservice/logging.properties -Dfile.encoding=UTF-8  -Dserver.port=80 -XX:ErrorFile=/home/LogFiles/java_error_GSHFLCSpringApiDev_10-30-0-53_%p.log -XX:+CrashOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/LogFiles/java_memdump_GSHFLCSpringApiDev_10-30-0-53.log -Duser.dir=/home/site/wwwroot -jar /home/site/wwwroot/app.jar:/usr/local/appservice/lib/azure.appservice.jar
2023-09-15T01:32:34.452219635Z: [INFO]  Launched child process with pid: 97
2023-09-15T01:32:34.458934106Z: [ERROR]  Error: Unable to access jarfile /home/site/wwwroot/app.jar:/usr/local/appservice/lib/azure.appservice.jar
2023-09-15T01:32:34.482425006Z: [INFO]  Waiting for main process to exit. GLOBAL_PID_MAIN=97
2023-09-15T01:32:34.482808739Z: [INFO]  Done waiting for main process. GLOBAL_PID_MAIN=97.
2023-09-15T01:32:34.482832341Z: [INFO]  Exiting entry script!

From what I understand , it is because the server is being sent a bad request during deployment, hence the server return empty body

Here is my Configuration for the Azure Maven Plugin

 <plugin> 
        <groupId>com.microsoft.azure</groupId>  
        <artifactId>azure-webapp-maven-plugin</artifactId>  
        <version>2.12.0</version>  
        <configuration>
          <schemaVersion>v2</schemaVersion>
          <subscriptionId>767121d7-cf5e-4725-a8bf-39eeed5da6ac</subscriptionId>
          <resourceGroup>GSHFLCSpringApiDevResourceGroup</resourceGroup>
          <appName>GSHFLCSpringApiDev</appName>
          <pricingTier>F1</pricingTier>
          <region>Southeast Asia</region>
          <runtime>
            <os>Linux</os>
            <javaVersion>Java 17</javaVersion>
            <webContainer>Java SE</webContainer>
          </runtime>
          <deployment>
            <resources>
              <resource>
                <directory>${project.basedir}/target</directory>
                <includes>
                  <include>*.jar</include>
                </includes>
              </resource>
            </resources>
          </deployment>
        </configuration>
      </plugin> 
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
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 18,451 Reputation points
    2023-10-13T06:31:45.3566667+00:00

    Hello @Anonymous apologies for the delayed response. The error you’re encountering is a common issue when deploying to Azure Web App. It’s often due to the server receiving a bad request during deployment. Here’s a few things to try to resolve this issue:

    1. Ensure you are using the latest version of the azure-webapp-maven-plugin. The current version is 1.17.0:
    2. Verify your pom.xml file is configured properly for the plugin according to the Spring documentation
    3. Lastly set an application setting WEBSITE_WEBDEPLOY_USE_SCM and value true in Azure Portalsthen Retry the deployment after 1 minute

    Here are the steps to set the application setting: Go to Azure portal > Navigate to App service > Go to Configuration >Add application setting and save it

    If the problem persists after trying those steps, please let us know.

    -Grace


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.