We are currently experimenting with deploying all of our web-based services as
executable wars created by the tomcat7-maven-plugin's "exec-war" goal. Our
deployment format is RPM, so we wrapped this exec-war into some standard linux
service and packaged everything as an RPM. So far, we really like the
simplicity of this process compared to what we used to do before, namely
deploying war files into a regular tomcat container. We do not want to go back
there.
The one nagging problem we face, though, is that so far we have not been able
to gracefully shutdown our running tomcat service. The only thing that "works"
for us is "kill –9". It goes without saying that this is not something you
should do in production.
We tried two alternatives:
1. Tried to gracefully shutdown tomcat exec-war by sending its process the
SIGINT signal ("kill –2 ${tomcatpid}). According to our researches, this should
be equivalent to a CTRL-C in the console (which we do not have in production).
Alas, tomcat exec-war seems to ignore this.
2. Since our exec-war uses a custom server.xml, we expected it to open
tomcat's well-known shutdown port. If we start tomcat with debug logging turned
on, we actually see that Digester, when parsing our server.xml, creates a
StandardServer with shutdown port 8505. A "netstat –tulpn | grep 8505" before
starting tomcat exe-war confirms that this port is available. However, after
tomcat exec-war has started nothing listens on this port. So this approach has
failed for us, too.
So my question is: is there a way to gracefully shutdown a running tomcat7
executable war as built by the tomcat7-maven-plugin-2.1? If yes, what does this
way look like? As always, any help is more than welcome.
Best, Olaf