If two executions are configured, for example to create two tomcat instances running on separate ports, these do not behave independently, as they get identified to JMX using the same names.
Some disambiguation is required, for which the httpPort might be enough (this works for me for tomcat6)
// create engine
Engine engine = container.createEngine();
- engine.setName( "localEngine" );
+ engine.setName( "localEngine-" + port);
engine.addChild( host );
engine.setDefaultHost( host.getName() );