tomcat7jmxcargo-maven2-plugin

Tomcat stop and restart issue using cargo maven


I am using cargo maven plugin for start/stop tomcat and deploy wars for running integration test.

Declared jmxremote.port 10082 in cargo jvmargs.

I have given different cargo.servlet.port than the default one.

Most of the times, not facing any issues. But atleast once a day, facing the below issue while restarting the tomcat.

Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 10082; nested exception is: java.net.BindException: Address already in use

How can I overcome the issue.

Thanks.


Solution

  • Great explaination here: http://www.curiouslycorrect.com/blog/2011/01/shutting-down-tomcat-when-running-with-maven-cargo-and-jmx/

    Apparently the new JVM for shutdown uses the same system properties and tries to a=start another JMX instance using the same JMX port.