Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have problem in shutting down tomcat server. When I type localhost://8080, it keeps on showing me tomcat homepage. I restarted the system also but did not help. I have already tried following commands and it did not show any process which might be running on port 8080 (Following commands did not output anything.)

netstat -anp|grep :8080[[:blank:]]

fuser -n tcp 8080

lsof -w -n -i tcp:8080

netstat | grep 8080

I also tried netstat -tulpn which shows following. I dont see any process running on port 8080 there.

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State            PID/Program name
tcp        0      0 0.0.0.0:17500           0.0.0.0:*               LISTEN         2091/dropbox    
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1046/mysqld     
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      7657/dnsmasq    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      901/cupsd       
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      5704/postgres   
tcp6       0      0 ::1:631                 :::*                    LISTEN      901/cupsd       
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           869/avahi-daemon: r
udp        0      0 0.0.0.0:46045           0.0.0.0:*                           869/avahi-daemon: r
udp        0      0 127.0.0.1:53            0.0.0.0:*                           7657/dnsmasq    
udp        0      0 0.0.0.0:17500           0.0.0.0:*                           2091/dropbox    
udp6       0      0 :::51917                :::*                                869/avahi-daemon: r
udp6       0      0 :::5353                 :::*                                869/avahi-daemon: r

Could someone please tell me how to free port 8080. I tried to run ./shutdown of tomcat but it shoed java.net.ConnectException: Connection refused

I guess it is because of already running instant on port8080.

Thanks.

share|improve this question
    
This is not an Ubuntu problem. You have your tomcat configured to use the 8080 port, and there's also other port that is configured for shutdown. You need to review your tomcat configuration ../conf/server.xml –  LnxSlck Oct 1 '12 at 14:11

2 Answers 2

up vote 1 down vote accepted

If you installed tomcat from Software Center (or via apt-get command line), then it should be running from the standard ubuntu installation directory. Starting and stopping Tomcat should be as easy as

/etc/init.d/tomcat5.5 start
/etc/init.d/tomcat5.5 stop

Maybe 5.5 needs to be replaced by the version you are using.

If you just downloaded tomcat and are running from your custom unzipped directory, the startup and shutdown scripts provided by Apache should work. Assuming your tomcat is in $TOMCAT_HOME:

$TOMCAT_HOME/bin/startup.sh
$TOMCAT_HOME/bin/shutdown.sh

If all fails, you can always manually kill all java processes

killall java

or, if something is REALLY stuck

killall -9 java

These last ones will kill ALL java processes currently running.

share|improve this answer
ps -ef |grep 'catalina'

then take that pid

kill -9 $pid

alternatively if you want to free 8080 port

Change your tomcat port to other than 8080

vi $CATALINA_HOME/conf/server.xml

search for the following section and then change port number to any thing of you choice.

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />

save the changes and restart the tomcat. Now your 8080 port will be free as tomcat will be running to alternative port you changed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.