Tomcat suddenly stops after startup
Working with Tomcat, I have on occasion ran across a strange issue where the Tomcat service would stop as soon as I started the service. I found two options to review to see if solves my issue. If these two options do not work for me, I will have to return to researching on the Internet.
Option One
I have encountered where customers would install security software that used the same port as the Tomcat Shutdown port. In a default installation of Apache Tomcat 8, port 8005 is used to signal a Tomcat shutdown. If another service is using this port, Tomcat will shutdown. I simulated this experience by starting up a web server at port 8005, then attempted to startup Tomcat (using default port 8080 and shutdown port 8005). On the customer’s server and from a Command Prompt I used the following command.
netstat -ano
This allowed me to see the PID of the service that was using the port number. I would then see if the customer could either disable the service running on port 8005 or switch the port used. If not, I would edit the Tomcat server.xml file to use a different shutdown port, for example port 8006. The edit and restart of Tomcat seems to work without issue.
Option Two
For most cases, seeing Tomcat stop as soon as you attempt to start was almost always a shared port issue. However, just this week I encountered a customer server where this was not the case. After reviewing all of the Tomcat files under the ‘lib’ directory and matching file sizes against a known good source, I found that the ‘tcnative-1.dll’ file was a different size. What had happened, was there was a major power outage of the VM server and the virtual machine running my Tomcat instance was hard shutdown and caused the ‘tcnative-1.dll’ file to become corrupted. After replacing the file with a known good version, the Tomcat service started up as normal.
Conclusion
These attempts at a fix are not likely the only options to check, but have been the two I have run across thus far. For future issues I will definitely look at these two first, but then I need to think about other troubleshooting techniques to hopefully solve.