I tried to shutdown tomcat as shown below, but tomcat still seems to be running (http://localhost:8080/)
vandegraff@vandegraff-laptop:~$ /usr/share/tomcat6/bin/shutdown.sh Using CATALINA_BASE: /usr/share/tomcat6 Using CATALINA_HOME: /usr/share/tomcat6 Using CATALINA_TMPDIR: /usr/share/tomcat6/temp Using JRE_HOME: /usr 1 Nov, 2010 11:41:40 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Catalina.stop: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at java.net.Socket.<init>(Socket.java:375) at java.net.Socket.<init>(Socket.java:189) at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:422) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:337) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Why is that?
Update1 for @hvgotcodes:
Output of ps -ax | grep java
1597 ? Ss 0:00 /usr/bin/jsvc -user tomcat6 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager -Djava.security.policy=/var/lib/tomcat6/work/catalina.policy -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties org.apache.catalina.startup.Bootstrap
1598 ? S 0:00 /usr/bin/jsvc -user tomcat6 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager -Djava.security.policy=/var/lib/tomcat6/work/catalina.policy -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties org.apache.catalina.startup.Bootstrap
1599 ? Sl 0:20 /usr/bin/jsvc -user tomcat6 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager -Djava.security.policy=/var/lib/tomcat6/work/catalina.policy -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties org.apache.catalina.startup.Bootstrap
Should all these 3 processes - 1597, 1598, 1599 - be killed?
When running Tomcat under jsvc, it will not respond to the shutdown signal on the specified shutdown port which is sent from the shutdown.sh script. The only way that I'm aware of is to kill the process, however you'll need to kill the ones listed as jsvc, not java.
Try
/etc/init.d/tomcat stop
(maybe you have to write something after tomcat
, just press tab one time)
Edit: And you also need to do it as root.
Caveat: I'm running Ubuntu
sudo service --status-all
you can get a list of all running services by typing this command,
If you're running Tomcat as a service it will showes up as ("tomcat"), so run :
sudo service tomcat7 stop
(tomcat7 or 8 or depending to the name that you have in the list of running services )
else and if you are using apache tomcat you will see ("apache2") showing up with the list of services then run :
sudo service apache2 stop
None of the suggested solutions worked for me.
I had run tomcat restart
before completing the deployment which messed up my web app.
EC2 ran tomcat automatically and tomcat was stuck trying to connect to a database connection which was not configured properly.
I just needed to remove my customized context in server.xml, restart tomcat and add the context back in.
To stop apache process try this command
ps aux | grep tomcat | awk '{print $2}' | xargs kill -9
Try using this command : (this will stop tomcat servlet this really helps)
sudo service tomcat7 stop
or
sudo tomcat7 restart (if you need a restart)
if you are run this command
debian@debian:~$ /usr/share/tomcat7/bin/shutdown.sh
then your server will not stop and you will get o/p like that you provided if you use in
super user mode then effect will appear o/p will come like this
debian@debian:~$ sudo /usr/share/tomcat7/bin/shutdown.sh
[sudo] password for debian:
Using CATALINA_BASE: /var/lib/tomcat
Using CATALINA_HOME: /var/lib/tomcat
Using CATALINA_TMPDIR: /var/lib/tomcat/temp
Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
Using CLASSPATH: /var/lib/tomcat/bin/bootstrap.jar:/var/lib/tomcat/bin/tomcat-juli.jar
For a more graceful way, try the following:
Caveat: I'm running Debian 7, not Ubuntu, though it is a Debian derivative
If you're running Tomcat as a service, you can get a list of all running services by typing:
sudo service --status-all
I'm running Tomcat 7, which is displayed as tomcat7 in said list. Then, to shut it down just type:
sudo service tomcat7 stop
If you installed tomcat
manually, run the shutdown.sh(/.../tomcat/bin)
from the terminal to shut it down easily.
if you have yout tomcat installed you can do :
sh path2tomcat/bin/shutdown.sh
Source: Stackoverflow.com