Friday, August 14, 2009

Tomcat Hangs After Restart

Tomcat 6.0.18
jdk1.6.0_12
apache-ant-1.7.1
Cocoon 2.1.11

Well, I have been working with Eclipse Galileo with BIRT the past few weeks and I have to say it's one of the best finds of recent memory.

It's great to be able to develop reports on my XP laptop with Galileo's friendly IDE and then easily deploy my reports to the BIRT Report Viewer on my Centos server.

The only issue (most likely my Tomcat restart script or some other fault on my end) is that after adding a new report and restarting Tomcat, I find that the Tomcat Manager, along with the BIRT report viewer hangs.

A check showed that after restart Tomcat appears to be up:

[root@server1 ~]# ps aux | grep -i tomcat
root 24216 0.2 4.2 1186320 172692 ? Sl 14:23 0:20 /usr/java/jdk1.6.0_12/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/share/apache-tomcat-6.0.18/conf/logging.properties -Djava.endorsed.dirs=/usr/share/apache-tomcat-6.0.18/endorsed -classpath :/usr/share/apache-tomcat-6.0.18/bin/bootstrap.jar -Dcatalina.base=/usr/share/apache-tomcat-6.0.18 -Dcatalina.home=/usr/share/apache-tomcat-6.0.18 -Djava.io.tmpdir=/usr/share/apache-tomcat-6.0.18/temp org.apache.catalina.startup.Bootstrap start
root 24745 0.0 0.0 3900 652 pts/0 R+ 16:41 0:00 grep -i tomcat
root 27432 5.3 6.8 1209172 277096 ? Sl Jul29 56:54 /usr/java/jdk1.6.0_12/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/share/apache-tomcat-6.0.18/conf/logging.properties -Djava.endorsed.dirs=/usr/share/apache-tomcat-6.0.18/endorsed -classpath :/usr/share/apache-tomcat-6.0.18/bin/bootstrap.jar -Dcatalina.base=/usr/share/apache-tomcat-6.0.18 -Dcatalina.home=/usr/share/apache-tomcat-6.0.18 -Djava.io.tmpdir=/usr/share/apache-tomcat-6.0.18/temp org.apache.catalina.startup.Bootstrap start

However, after sstopping Tomcat, when I issue pas -a, there are still java processes running.

[root@server1 ~]# service tomcat stop
Shutting down tomcat: Using CATALINA_BASE: /usr/share/apache-tomcat-6.0.18
Using CATALINA_HOME: /usr/share/apache-tomcat-6.0.18
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.18/temp
Using JRE_HOME: /usr/java/jdk1.6.0_12
done.
[root@server1 ~]# ps -a
PID TTY TIME CMD
24881 pts/0 00:00:20 java
24945 pts/0 00:00:00 ps

So, issue killall -9 java:

[root@server1 ~]# killall -9 java


Look at ps again:

[root@server1 ~]# ps -a
PID TTY TIME CMD
24957 pts/0 00:00:00 ps

Now start up Tomcat:

[root@server1 ~]# service tomcat start
Starting tomcat: Using CATALINA_BASE: /usr/share/apache-tomcat-6.0.18
Using CATALINA_HOME: /usr/share/apache-tomcat-6.0.18
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.18/temp
Using JRE_HOME: /usr/java/jdk1.6.0_12
done.
[root@server1 ~]#

And now my Manager, my Report viewer, and my newly added report are all accessible.

I have been using this same Tomcat script for some time now and have never had any issues restarting after changes. So I'm not sure if it is my script (most likely), or the BIRT viewer, or some other oversight on my part.

In any event, I won't be giving up my Galileo or Report Viewer any time soon.