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:
Server port 8009 did not shutdown within the timeout period 
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:
-server -Xmx256m -Xms256m
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.