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?)
Installing Tomcat using:
should install and start up Tomcat as a service just fine. The service can be started and stopped using:
You can verify if the service is running by viewing
http://localhost:8080/
, either using a browser or from the command line: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:
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.