|Department of Computing||Imperial College London|
|Using Personal Tomcat 6|
Some Tomcat History
Personal Tomcat Setup at DoC
Recap: How to set up a Context Directory
More detailed JSP and Servlet examples
A Little Tomcat History
For several years, we attempted to build and maintain shared Tomcat servers, which many users could use to develop JSP and servlet webapps in parallel. However, they were always unreliable, and we have concluded that Tomcat's fundamental design is not suited to the teaching environment.
One of those unreliable shared Tomcat web servers still exists, but it is now deprecated (and probably broken) - we strongly recommend that you do not attempt to use it, and we do not intend to replace it!
Personal Tomcat at DoC
Instead, therefore, we have designed (and now strongly recommend) something we call Personal Tomcat: as of 1st April 2009, we have just taken the latest version of Tomcat (version 6.0.18), packaged it and installed it on every DoC Ubuntu Hardy (8.04) linux lab machine. However, on these lab machines, Tomcat has not been configured or started. That's something you need to do - hence, it's a private and personal Tomcat system.
Note that this creates the directory
~/example-context and populates it,
~/example-context must not already exist
when you run this command.
cd ~/example-context and look around - especially read the
README file which describes everything in considerable detail.
The rest of this web page covers essentially the same material
as the README file does!
~/example-context, you can add your web content and
alter Tomcat configuration settings as much as you like. Here's a few hints:
web-apps/ROOT(you'll find an
index.jspfile already in there, containing some content as an example).
conf/server.xml: This allows you to - for instance - change the port that Tomcat will start on, set to 59999 by default, or make Tomcat start up with https support instead.
When you want to start tomcat on your current desktop
machine (suppose you're using vector17) for a few minutes
in order to test your JSP code or servlets, make sure that your
current working directory is still
Assuming that Tomcat has started ok (read the logs in the logs subdir, see the README for details), point your web browser at:
Note: Here, obviously, if you choose a different port then replace 59999 with your chosen port no.
This system gives you a much better level of control, it's only your web app running, so no interference is possible, you even get to modify the config files, and you choose when to start and stop tomcat.
You could even set up several personal tomcat webapp directories, to test different servlets, web-apps, or versions of a complex system as you build it.
PS: It's probably best NOT to put such personal tomcat dirs inside public_html, as that allows Apache to serve out the source code and other private stuff, which might reveal database passwords etc by accident.
How to do I find out what's Wrong?
When things don't work with Personal Tomcat, as with all previous versions of Tomcat, you'll see an incomprehensable Java stacktrace as the web page result. However, very useful debugging information comes from looking in the
logs subdirectory, and you may even be able to start Tomcat
in debugging mode next time by modifying the config!
http://localhost:59999/index.jspand you should see the output of the index.jsp file, with it's 2D array of grey boxes.
More Detailed JSP and Servlet Examples
For some more information on JSP, Servlets and Kerberos authentication in servlets, see the following documents:
How to do Kerberos authentication from Java
|© CSG / Apr 2009|