[Java][Web Apps] Tomcat restart in deployment script ? RRS feed

  • Question

  • Hello everyone,

    I'm wondering if restarting Tomcat from a deployment script is possible ?


    I have a .war Java Application to deploy on my Azure Web App running on Tomcat 7.0.62 (created with App Services UI).

    To do so, I use Continuous Deployment (Configured with Git Local). I simply push my .war into the webapps/ folder, which triggers Tomcat's deployment. The application is well deployed, everything works fine.

    Now, I would like to avoid PermGen Space errors to occure. I know this error could occured by deploying the .war several times without restarting Tomcat.

    My solution to avoid PermGen Space error is to restart Tomcat. I tried to do so on Azure Web App:

    - Check for environment variable "AZURE_TOMCAT7_HOME"

    - Executing AZURE_TOMCAT7_HOME\bin\shutdown.bat   (THIS DOES NOT WORK)

    - Executing AZURE_TOMCAT7_HOME\bin\startup.bat

    This is done in the deployment script "deploy.cmd" with a ".deployment" file. (files generated with azure-cli)

    The 2nd step does not work. I can't shutdown Tomcat because the Shutdown port is not configured. I suppose it's not made to be configured.

    My Questions:

    Is it possible to restart Tomcat from the deployment script ? Is it risky ?

    Can I automatically restart the Web App (like I would click on Restart button on Azure Portal) ?


    Wednesday, March 2, 2016 9:56 AM


  • Hi,

    Per my experience, I think you can try to combine Azure Automation with the PowerShell cmdlet Restart-AzureRmWebApp  to implement your needs.

    Please refer to these documents below.

    1. For creating the Automation & runbook, please see

    2. About the cmdlet Restart-AzureRmWebApp, please see

    There is the trainning videos for Azure Automation at

    Hope it helps.

    Best Regards.

    Thursday, March 3, 2016 5:20 AM

All replies