We use cargo maven plugin at work to set up some container tests for our services. One of the services I checked out had a problem with it's container tests but only when they were executed via our hudson.
The error message said something like:
org.codehaus.cargo.container.ContainerException: Failed to stop the Tomcat 6.x container.
and below that:
org.codehaus.cargo.container.ContainerException:
Server port 8009 did not shutdown within the timeout period [120000]
Now I don't know much about anything as complicated as ports allocation, but I can check if something is running on a given port (thank you google). I run following command after the build failed on our hudson box:
netstat -an | grep "8009"
tcp 0 0 :::8009 :::* LISTEN
Again, don't know much about this stuff, but I'm guessing something is still running on that port. I don't own hudson box, and I don't want to break anything, so I decided to just change the tomcat AJP port for my container tests. To do that I used a cargo plugin configuration property (cargo.tomcat.ajp.port), like that:
org.codehaus.cargo
cargo-maven2-plugin
tomcat6x
file:///${basedir}/container/apache-tomcat-6.0.18.zip
${project.build.directory}/container-install-${test.container.port}
standalone
${project.build.directory}/container-config-${test.container.port}
${test.container.port}
-server -Xmx256m -Xms256m
8093
...
...
That worked pretty well, tomcat is now closing fine and the build is successful.
If you need something even more sophisticated when you start up your container, you can use ant run tasks in start and or stop goal. For more info you can check this Curiously Correct blog post.
For more info on cargo maven plugin visit cargo.codehouse.org, especially their maven plugin tips page.
Great, thanx, that helped a lot. Running 8 Tomcats for a long time on the same machine lets you forget about the basic configuration like ajp :-(
ReplyDeleteGlad it was useful :)
ReplyDeleteThanks, this helped me, too.
ReplyDeleteI had exactly the same problem (building with Hudson a project that runs Cargo)
ReplyDeleteThanks for the post!
Thank you, it has served me a lot.
ReplyDeleteWonderful. Thanks Buddy
ReplyDelete