title: Team City: Cannot Redeploy to Tomcat7
body: <p>I have a build configuration that uses the Team City deployer plugin.
  I'm using a container deploy to deploy the war file to Tomcat.7.0.63 installed as a service on a Windows Server 2012 R2 box.
  The first time I run the the build, the artifact (a war file_ deploys successfully.
  The second time, and all subsequent runs, the deploy fails.</p>
  
  <p>The error message:</p>
  
  <pre><code>Build failure message received: org.codehaus.cargo.container.ContainerException: Failed to undeploy
  </code></pre>
  
  <p>The log file error:</p>
  
  <pre><code>Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Unable to delete
  </code></pre>
  
  <p>When I go to the webapps folder on the remote server, the war file is deleted, but the expanded folder is only partially deleted. Most files are gone, except for a png file. 
  I am not able to manually delete the folder because Tomcat still has a lock on it.
  If I restart tomcat, I'm then able to run the build successfully (war file deploys).</p>
  
  <p>One thought I had was to restart Tomcat before or after each deploy.
  How would I restart Tomcat from TeamCity?
  Or perhaps, does anyone have suggestions on how to fix this problem?</p>