Deploying artifacts to tomcat will sometimes fail on due to file locking
When a plan is configured to use Deploy Tomcat application task to deploy the generated artifacts to tomcat (as explained here - Using Tomcat with Bamboo for continuous deployment) and if it sometimes fails with the below error in the
Starting task 'Deploy test' of type 'com.atlassian.bamboo.plugins.tomcat.bamboo-tomcat-plugin:deployAppTask' Deploying application with war file 'test.war' to context '/hello' to server 'http://localhost:8080/manager/' Application failed to deploy: FAIL - Unable to delete [D:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\hello]. The continued presence of this file may cause problems. FAIL - Application already exists at path /hello
This is more common in Windows OS where tomcat will lock files or directory location. In most cases this happens after the first succesfull deployment and subsequent ones will be blocked. Even though this is more common in Windows, it might affect the linux OS as well and the same resolution should be applied on both.
This can be fixed by adding <Context antiResourceLocking="true"> to tomcat context. The
antiResourceLocking is by default set to false. More details can be read at http://tomcat.apache.org/tomcat-5.5-doc/config/context.html .