Tuesday, May 1, 2012

Apache Tomcat 6 Shutdown Failure Resolution on SUSE Enterprise 11

Recently, in a development environment, and customer site production environment we noticed some issues shutting down Apache Tomcat for our Queue Manager product running on SUSE Enterprise Linux 11. Running './catalina.sh stop' appeared to work fine, but upon further inspection, it failed to stop it's running Java process, and it left its PID file behind (/var/run/tomcat6.pid). Running the '/etc/init.d/tomcat6 stop' command showed us that, in fact, there was an error in the shut down process.

Review of the catalina.out log file revealed a permissions error writing one of the logs. The log entry itself wasn't terribly helpful, but the implications of a permissions issue were intriguing. It's important to mention that we installed Tomcat 6 using SUSE's YaST tool, we hadn't built it from source, so permissions problems shouldn't be an issue. After inspecting Tomcat's directories, I decided to explicitly give group execution privileges to the folders. The folders were already set to attributes 755, so that didn't appear to be an issue. I used the commands below for the Tomcat directories.

Before starting Tomcat again, I removed the PID file (/var/run/tomcat6.pid), killed the left behind Java process (using kill), and cleared out our logs. Once Tomcat was started, and everything was running smoothly, we sent the shutdown.

This time it shut down fine. Upon further inspection the spawned Java process that had lingered before was gone, as was the PID file. Further inspection of the logs showed no further errors with Tomcat's shut down either.

No comments: