Pytry
Pytry

Reputation: 6390

Team City: Cannot Redeploy to Tomcat7

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.

The error message:

Build failure message received: org.codehaus.cargo.container.ContainerException: Failed to undeploy

The log file error:

Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Unable to delete

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).

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?

Upvotes: 1

Views: 334

Answers (1)

SteveChapman
SteveChapman

Reputation: 3081

You can configure the Tomcat Context using the antiResourceLocking option, as detailed further in the online documentation. This does come with some trade-offs however; definitely worth reading the documentation in full and evaluating if it's a suitable option for your application.

Upvotes: 1

Related Questions