Re-deploying a “versioned” war file from Jenkins to Tomcat fails

戏子无情 提交于 2019-12-24 13:37:46

问题


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:


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.



来源:https://stackoverflow.com/questions/26845225/re-deploying-a-versioned-war-file-from-jenkins-to-tomcat-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!