1
votes

I am using the Jenkins deploy plugin to deploy to Tomcat. The .war file that gets generated is named using the following format: MyApp##[version].[buildnumber].war

For example, the war file will be generated as: MyApp##alpha.13.war

The reason for the hashes in the filename is for Tomcat manager html page to list the version in the version column of the deployed applications. This way, we can double check which version is currently deployed to Tomcat.

Now when trying to deploy via Jenkins for a second time, the build number obviously increases. So the above war file will be generated with the file name: MyApp##alpha.14.war

This now fails with the below exception:

Deploying C:\Users\davidr.jenkins\jobs\Task Form Builder (trunk)\workspace\target\TaskFormBuilder##alpha.21.war to container Tomcat 7.x Remote Redeploying [C:\Users\davidr.jenkins\jobs\Task Form Builder (trunk)\workspace\target\TaskFormBuilder##alpha.21.war]
Undeploying [C:\Users\davidr.jenkins\jobs\Task Form Builder (trunk)\workspace\target\TaskFormBuilder##alpha.21.war] ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception org.codehaus.cargo.container.ContainerException: Failed to undeploy [C:\Users\davidr.jenkins\jobs\Task Form Builder (trunk)\workspace\target\TaskFormBuilder##alpha.21.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:140) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:178) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103) at hudson.FilePath.act(FilePath.java:919) at hudson.FilePath.act(FilePath.java:897) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683) at hudson.model.Run.execute(Run.java:1784) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - No context exists for path /TaskFormBuilder##alpha.21

at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:480) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.undeploy(TomcatManager.java:420) at org.codehaus.cargo.container.tomcat.Tomcat7xRemoteDeployer.performUndeploy(Tomcat7xRemoteDeployer.java:62) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:130) ... 17 more org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - No context exists for path /TaskFormBuilder##alpha.21

at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:480) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.undeploy(TomcatManager.java:420) at org.codehaus.cargo.container.tomcat.Tomcat7xRemoteDeployer.performUndeploy(Tomcat7xRemoteDeployer.java:62) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.undeploy(AbstractTomcatManagerDeployer.java:130) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:178) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103) at hudson.FilePath.act(FilePath.java:919) at hudson.FilePath.act(FilePath.java:897) at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683) at hudson.model.Run.execute(Run.java:1784) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) Finished: FAILURE

Can anyone assist with how to get Jenkins to re-deploy a war file to Tomcat using tomcats suggested naming convention (using hashes so specify the version) ?

1
Did you find a resolution to this query.Mohit

1 Answers

2
votes

I think you'll find the deployment actually works, it just reports the error.

This is a bug in the deployer plugin or cargo code see JIRA issue https://issues.jenkins-ci.org/browse/JENKINS-19564.