Use a browser to check whether Tomcat is running on URL http://localhost:8080 , where 8080 is the Tomcat port specified in conf/server. xml. If Tomcat is running properly and you specified the correct port, the browser displays the Tomcat homepage.
Go to the project in the Project Explorer, select the web project, right click and select "Run As", you will see Apache Tomcat, create runtime configuration for the web project by selecting "New" button.
On my linux system, I start Tomcat with the startup.sh script. To know whether it is running or not, i use
ps -ef | grep tomcat
If the output result contains the whole path to my tomcat folder, then it is running
try this instead and because it needs root privileges use sudo
sudo service tomcat7 status
Why grep ps
, when the pid has been written to the $CATALINA_PID
file?
I have a cron
'd checker script which sends out an email when tomcat is down:
kill -0 `cat $CATALINA_PID` > /dev/null 2>&1
if [ $? -gt 0 ]
then
echo "Check tomcat" | mailx -s "Tomcat not running" [email protected]
fi
I guess you could also use wget
to check the health of your tomcat. If you have a diagnostics page with user load etc, you could fetch it periodically and parse it to determine if anything is going wrong.
netstat -lnp | grep 8080
would probably be the best way, if you know Tomcat's listening port. If you want to be certain that is is functional, you will have to establish a connection and send an HTTP request and get a response. You can do this programatically, or using any web browser.
You can check the status of tomcat with the following ways:
ps -ef | grep tomcat
This will return the tomcat path if the tomcat is running
netstat -a | grep 8080
where 8080 is the tomcat port
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With