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>
Hi @Anonymous
We are sorry to hear you're facing this problem. We are checking internally with the engineering team to see if this is a known issue and will get back to you when we hear back from them.
Best,
Grace
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:
Ensure you are using the latest version of the azure-webapp-maven-plugin. The current version is 1.17.0:
Verify your pom.xml file is configured properly for the plugin according to the Spring documentation
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
@Yong Minyue thanks for bringing for the update. It looks like this issue requires deeper investigation. Could you please send us an email to AzCommunity[at]Microsoft[dot]com with the below details, so that we can enable a one-time-free support for you to work closely on this issue?
Email subject: <Attn - Grace >
Thread URL: <Microsoft Q&A Thread>
Subscription ID: <your Azure subscription id>
Please let me know here once the email is sent along with above requested details.
Thanks,
Grace