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 installed tomcat6 on lucid using the instructions here: https://help.ubuntu.com/10.04/serverguide/C/tomcat.html

(I didn't create an instance level version - the system level version was fine)

When I tried to start it up I got the following error in the log:

java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:216)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:391)

This was resolved by doing the following:

root@...:/var/lib/tomcat6# ln -s /usr/share/java lib

Why did I need to do this? Why doesn't it work out the box? (Why isn't this in the Ubuntu Manual on Tomcat?)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Installing Tomcat using:

sudo apt-get install tomcat6

should install and start up Tomcat as a service just fine. The service can be started and stopped using:

sudo /etc/init.d/tomcat6 start
sudo /etc/init.d/tomcat6 stop

You can verify if the service is running by viewing http://localhost:8080/, either using a browser or from the command line:

curl http://localhost:8080/

If this is not working out of the box for you then something is either odd about how your machine is set up, or about how you are trying to run the Tomcat service.

If you are trying to run Tomcat in any way other than using the /etc/init.d/tomcat6 script, you are likely to run into complications. There are two environmental variables that define where the Tomcat distribution and files are located; CATALINA_HOME and CATALINA_BASE. For a vanilla installation of the package, these will end up being set automatically by the init.d script to:

CATALINA_HOME=/usr/share/tomcat6
CATALINA_BASE=/var/lib/tomcat6

If you are trying to run Tomcat in some other other way, it is possible that these variables are not set correctly which could result in the error you are describing.

The packaged Tomcat server is designed to be used for running Tomcat as a background service on a server, and as such should really only be started and stopped using the init.d script. If you are trying to run Tomcat on a development machine (eg, from an IDE such as Eclipise), then you will find that the way the package installs Tomcat is unsuitable, and you should instead be installing a private instance either using the instructions in the server manual or by downloading it directly from the Tomcat website and extracting it manually.

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.