Deploying versioned WAR to Tomcat 7

206 views
Skip to first unread message

Mark Eggers

unread,
Aug 4, 2014, 7:55:25 PM8/4/14
to jenkins...@googlegroups.com
Hi,

I'm trying to use the deploy plugin to deploy to a Tomcat 7.0.55 server.
I'm trying to use versioned WAR files (appName##number.war).

I can create the WAR file easily by passing BUILD_NUMBER in on the command line
and then using a property within finalName.

The first problem came when specifying the WAR file for the deploy plugin. Using
appName##${BUILD_NUMBER}.war caused the underlying ant task to fail.
I "solved" that by using **/*.war.

Now Jenkins finds and attempts to deploy the WAR file only to get:

ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [/home/tcadmin/.jenkins/jobs/appName-Deploy/workspace/target/appName##9.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:189)
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:922)
at hudson.FilePath.act(FilePath.java:895)
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:772)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:736)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1040)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:685)
at hudson.model.Run.execute(Run.java:1757)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Unknown command /manager/text/list

I can successfully do an http://thor.mdeggers.org:8080/manager/text/list from the command line
using curl with the same authentication parameters.

$ curl --anyauth -u redacted:redacted http://thor.mdeggers.org:8080/manager/text/list
OK - Listed applications for virtual host thor
/:running:0:ROOT
/manager:running:4:/home/tcadmin/Apache/apache-tomcat-7.0.55/webapps/manager
/LeakRS:running:0:LeakRS
/probe:running:0:probe
/JSPSamples:running:0:JSPSamples
/nexus:running:0:nexus
/calcs:running:0:calcs

What am I doing wrong?

Mark
/mde/

Mark Eggers

unread,
Aug 4, 2014, 8:21:18 PM8/4/14
to jenkins...@googlegroups.com
Never mind, I figured it out. It turns out that the deploy URL in the configuration needs to be the base URL (http://thor.mdeggers.org:8080), and NOT the manager URL (http://thor.mdeggers.org:8080/manager/text).

Now I have to figure out how to filter context.xml so that I can run the application in NetBeans, and still have versioned applications on Tomcat. However, that's a Maven question.

Sorry for the noise.

Mark
/mde/

Mark Eggers

unread,
Aug 4, 2014, 9:23:40 PM8/4/14
to jenkins...@googlegroups.com
Further followup:

It seems that the Deploy plugin doesn't work well with versioned WAR files (ConsumeIt##nnn.war). The first deploy works as expected, and the second deploy (with an incrementally increased BUILD_NUMBER) fails with:

Deploying /home/tcadmin/.jenkins/jobs/ConsumeIT-Deploy/workspace/target/ConsumeIt##15.war
  to container Tomcat 7.x Remote

Redeploying [/home/tcadmin/.jenkins/jobs/ConsumeIT-Deploy/workspace/target/ConsumeIt##15.war]
Undeploying [/home/tcadmin/.jenkins/jobs/ConsumeIT-Deploy/workspace/target/ConsumeIt##15.war]
ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception
  org.codehaus.cargo.container.ContainerException: Failed to
  undeploy [/home/tcadmin/.jenkins/jobs/ConsumeIT-Deploy/workspace/target/ConsumeIt##15.war]

This is understandable, since there is no ConsumeIt##15.war. There was a ConsumeIt##13.war (running), and a ConsumeIt##14.war (failed to deploy with the same message as above).

Undeploying ConsumeIt##13.war from the command line with:


works as expected, and then the next Jenkins deployment works as well.

Maybe this is an enhancement request?

Mark
/mde/

Mark Eggers

unread,
Aug 5, 2014, 1:59:57 AM8/5/14
to jenkins...@googlegroups.com
This appears to be the following issue:


My initial take on this is that it's a Cargo issue with parallel deployment.

Mark
/mde/
Reply all
Reply to author
Forward
0 new messages