On Fri, Feb 14, 2014 at 2:03 PM, Caldarale, Charles R <
chuck.caldar...@unisys.com> wrote:

> > From: Leo Medina [mailto:leo.medi...@gmail.com]
> > Subject: RE: Unable to shutdown Tomcat
>
> > Hello have you tried:
> > ps -ef | grep <port number>
> > kill -9 <port number>
>
> You must have extremely odd implementations of ps and kill if you expect
> that to do anything useful.  Are you confusing port number with pid?
>
>  - Chuck
>

Nice catch Chuck.

Leo, you probably confused two: netstat and ps commands.

ps -ef | grep <port_number>

would work only if you provide port number on the command line of your
program, and that's not the case in default out-of-box Tomcat (uses
server.xml to define port numbers)

I would suggest:

ps -ef | grep java

would output the command line of all Java processes, and Tomcat is one of
them.
note the process id (PID) for your specific tomcat process

and then try killing the process, e.g.

kill <PID>
kill -9 <PID>

I prefer looking at netstat, as I might have multiple Tomcat instances
running, so I want to know exactly which one I want to "kill" ...

Netstat behaves differently on different OS. This is what I typically use
when troubleshooting my tomcat instances (knowing that it runs on port
8080):

netstat -aon | findstr 8080     (windows)
netstat -vatpn | grep 8080     (linux)
lsof -i TCP | grep 8080          (mac)


So, to further troubleshoot your problem - we need:

1) server.xml (as Chuck pointed out - without comments)
2) startup logfile
3) output of netstat (lsof) after the tomcat startup

Good luck!

Reply via email to