Can't start Tomcat on Ubuntu Feisty Fawn

Nothing at all - just silence, no logs, no nothing

Overview of the Problem

If you get tomcat5.5 and sun-java5-jdk from the ubuntu stable repository at the time of publishing tomcat's busted. It basically does nothing. All looks well when you run the startup script...



          $ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

          $ sudo /usr/share/tomcat5.5/bin/startup.sh

          Using CATALINA_BASE:   /usr/share/tomcat5.5

          Using CATALINA_HOME:   /usr/share/tomcat5.5

          Using CATALINA_TMPDIR: /usr/share/tomcat5.5/temp

          Using JRE_HOME:       /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

        

but netstat tells you nothing is actually going on...



          sudo netstat -plut

          Active Internet connections (only servers)

          Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name  

          tcp        0      0 *:www                   *:*                     LISTEN     3679/apache        

          tcp6       0      0 *:ssh                   *:*                     LISTEN     3602/sshd

        

The problem arises from a fifo at /usr/share/tomcat5.5/logs/catalina.out which is the target for normal console output from the catalina (tomcat launch) script. This fifo doesn't flow at all. Replacing it with a regular file fixes the problem and tomcat launches OK. This is also associated with a strange error on installation which looks like...



          Setting up tomcat5.5-admin (5.5.20-4ubuntu1) ...

          invoke-rc.d: initscript tomcat5.5, action "status" failed.

        

...and a failure to shutdown properly with an error which begins...



          SEVERE: Catalina.stop:

          java.net.ConnectException: Connection refused

          at java.net.PlainSocketImpl.socketConnect(Native Method)

        

The fix

My fix went like this, with my commands preceded by the dollar sign...



          $ cd /usr/share/tomcat5.5/logs

          $ ls -la

          total 8

          drwxr-x---  2 tomcat55 adm     4096 2007-06-20 00:52 .

          drwxr-xr-x 10 root     root    4096 2007-06-20 00:46 ..

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 admin.2007-06-20.log

          -rw-r--r--  1 root     root    2601 2007-06-20 00:52 catalina.2007-06-20.log

          prw-------  1 tomcat55 nogroup    0 2007-06-20 00:46 catalina.out

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 host-manager.2007-06-20.log

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 localhost.2007-06-20.log

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 manager.2007-06-20.log

          $ sudo mv catalina.out catalina.out.old

          $ sudo touch catalina.out

          $ sudo chown tomcat55:nogroup catalina.out

          $ ls -la

          drwxr-x---  2 tomcat55 adm     4096 2007-06-20 00:52 .

          drwxr-xr-x 10 root     root    4096 2007-06-20 00:46 ..

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 admin.2007-06-20.log

          -rw-r--r--  1 root     root    2601 2007-06-20 00:52 catalina.2007-06-20.log

          -rw-r--r--  1 tomcat55 nogroup 1463 2007-06-20 00:52 catalina.out

          prw-------  1 tomcat55 nogroup    0 2007-06-20 00:46 catalina.out.old

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 host-manager.2007-06-20.log

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 localhost.2007-06-20.log

          -rw-r--r--  1 root     root       0 2007-06-20 00:52 manager.2007-06-20.log

        

The result...

Finally! I get netstat reporting Tomcat with an open socket for its various connectors as configured in the conf/server.xml file.



          $ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

          $ sudo /usr/share/tomcat5.5/bin/startup.sh

          Using CATALINA_BASE:   /usr/share/tomcat5.5

          Using CATALINA_HOME:   /usr/share/tomcat5.5

          Using CATALINA_TMPDIR: /usr/share/tomcat5.5/temp

          Using JRE_HOME:       /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

          $ netstat -plut

          Active Internet connections (only servers)

          Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name  

          tcp        0      0 *:www                   *:*                     LISTEN     -                  

          tcp6       0      0 localhost:8005          *:*                     LISTEN     -                  

          tcp6       0      0 *:8009                  *:*                     LISTEN     -                  

          tcp6       0      0 *:8180                  *:*                     LISTEN     -                  

          tcp6       0      0 *:ssh                   *:*                     LISTEN     -      

        

Thanks to...

The bug report at launchpad.net which finally fixed the issue, and all those helping and theorising at irc://irc.freenode.net#tomcat

Which Ubuntu version am I running?

To tell which version of the ubuntu distribution you're running use this

lsb_release -ds

...and it reports in my case...

Ubuntu 7.04

I have version 5.5.20-4ubuntu1 for my tomcat5.5 and tomcat5.5-admin packages.

Theories

On the irc.freenode.net#tomcat pfn thought it was my catalina.sh file, which is here but this was actually fine. The java launch wasn't missing, it just never completed.

Adding -x to the #!/bin/sh declaration at the top of the catalina.sh file, (as suggested by randrew on the #tomcat channel on irc.freenode.net) gave me



          ./launchtomcat.sh

          + cygwin=false

          + os400=false

          + darwin=false

          + uname

          + PRG=/usr/share/tomcat5.5/bin/catalina.sh

          + [ -h /usr/share/tomcat5.5/bin/catalina.sh ]

          + dirname /usr/share/tomcat5.5/bin/catalina.sh

          + PRGDIR=/usr/share/tomcat5.5/bin

          + [ -z  ]

          + cd /usr/share/tomcat5.5/bin/..

          + pwd

          + CATALINA_HOME=/usr/share/tomcat5.5

          + [ -r /usr/share/tomcat5.5/bin/setenv.sh ]

          + false

          + false

          + false

          + [ -r /usr/share/tomcat5.5/bin/setclasspath.sh ]

          + BASEDIR=/usr/share/tomcat5.5

          + . /usr/share/tomcat5.5/bin/setclasspath.sh

          + CLASSPATH=

          + [ -z /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/ -a -z  ]

          + [ -z /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/ -a start = debug ]

          + [ -z  ]

          + JRE_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

          + [ start = debug -o start = javac ]

          + [ -z /usr/share/tomcat5.5 ]

          + [ ! -x /usr/share/tomcat5.5/bin/setclasspath.sh ]

          + JAVA_ENDORSED_DIRS=/usr/share/tomcat5.5/common/endorsed

          + [ start = debug -o start = javac ]

          + JIKESPATH=

          + uname -s

          + [ Linux = Darwin ]

          + _RUNJAVA=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11//bin/java

          + [ false != true ]

          + _RUNJDB=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11//bin/jdb

          + _RUNJAVAC=/usr/lib/jvm/java-1.5.0-sun-1.5.0.11//bin/javac

          + gcj=no

          + /usr/lib/jvm/java-1.5.0-sun-1.5.0.11//bin/java -version

          + grep -q ^gij (GNU libgcj)

          + [ -n  -a no != yes ]

          + CLASSPATH=:/usr/share/tomcat5.5/bin/bootstrap.jar:/usr/share/tomcat5.5/bin/commons-logging-api.jar

          + [ -z  ]

          + CATALINA_BASE=/usr/share/tomcat5.5

          + [ -z  ]

          + CATALINA_TMPDIR=/usr/share/tomcat5.5/temp

          + have_tty=0

          + tty

          + [ /dev/pts/0 != not a tty ]

          + have_tty=1

          + false

          + [ -r /usr/share/tomcat5.5/bin/tomcat-juli.jar -a no != yes ]

          + JAVA_OPTS= -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/share/tomcat5.5/conf/logging.properties

          + [ 1 -eq 1 ]

          + echo Using CATALINA_BASE:   /usr/share/tomcat5.5

          Using CATALINA_BASE:   /usr/share/tomcat5.5

          + echo Using CATALINA_HOME:   /usr/share/tomcat5.5

          Using CATALINA_HOME:   /usr/share/tomcat5.5

          + echo Using CATALINA_TMPDIR: /usr/share/tomcat5.5/temp

          Using CATALINA_TMPDIR: /usr/share/tomcat5.5/temp

          + [ start = debug -o start = javac ]

          + echo Using JRE_HOME:       /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

          Using JRE_HOME:       /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/

          + [ start = jpda ]

          + [ start = debug ]

          + [ start = run ]

          + [ start = start ]

          + shift

          + touch /usr/share/tomcat5.5/logs/catalina.out

          + [  = -security ]

          + [ ! -z  ]

        

Tagged:

ubuntu (3)

open source (3)

bug (2)

tomcat