arahant
arahant

Reputation: 2203

tomcat port closes

I have a Tomcat Server 7.0.54 running on port 6584 on an Amazon EC2 instance.

The server runs fine for a while but suddenly it seems to close the port on which it listens.

When it is running normally netstat -lnp | grep <pid_of_tomcat> gives me

tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      22999/java          
tcp6       0      0 :::8009                 :::*                    LISTEN      22999/java          
tcp6       0      0 :::6584                 :::*                    LISTEN      22999/java 

When it suddenly stops working, the tomcat instance is still running and there is enough memory on the machine. But netstat -lnp | grep <pid_of_tomcat> only gives me

tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      22999/java     

This suggests that tomcat is no longer listening on the port.

How can I explain why this happens? How can I debug the situation?

Upvotes: 1

Views: 267

Answers (4)

lowatt
lowatt

Reputation: 363

  1. check tomcat logs : catalina.out, localhost.log, etc.
  2. add this -Xrunhprof:cpu=samples,interval=10,depth=8 to your JAVA_OPTS, and check the "java.profile.txt" file generated when it happens again. (if you need to change some arguments, refer to this)

Upvotes: 1

KNOWARTH
KNOWARTH

Reputation: 922

Couple of thing which you can do for this is as below.

  1. Disabling all the ipv6 on the network devices
  2. Adjusted "{tomcat_home}/bin/setenv.sh" with the following:

     export CATALINA_OPTS="-Djava.net.preferIPv4Stack=true"
    

Upvotes: 1

Satish Shinde
Satish Shinde

Reputation: 2996

Check If there is any cron job running at system level for apt-packages. if yes then remove this cron job. I think this is the problem.

Upvotes: 0

souser
souser

Reputation: 6110

  1. If catalina.out does not contain anything, please check the os level log file. For Linux check /var/log/messages.
  2. In the netstat output you have shown earlier, is the pid the same or does it change over time ?

Upvotes: 1

Related Questions