Tomcat Setup for topcat.cs.umb.edu

We will be using the Linux system topcat.cs.umb.edu for tomcat. If tomcat is unavailable, you can use pe07.

IMPORTANT:

1. How to find out whether you have a Linux tomcat running:

a. After logging in on topcat.cs.umb.edu, use ps-aux |grep <your username> to see what you have running (even "daemons" like tomcat).  For example, I would use:
$  ps aux | grep eoneil | grep java

I have this command wrapped in a "ckjava" alias, using $USER instead of eoneil for generality, see tomcat.bash

b. Use netstat -a to see whether the machine you are on has ports active at the port numbers that were assigned to you.

2. Emergency stop of a tomcat you have started:

Normally, just use "shutdown.sh", using the shutdown script in tomcat's bin.
If this doesn’t work, kill any java processes running with you as owner: kill <pid>.

Setup instructions.

See the Tomcat user's guide for more details.

Tomcat is controlled by a configuration file named server.xml. A standard Tomcat hierarchy has these subdirectories, which you will duplicate in a subdirectory named tomcat8.5 under your course homeword directory, cs636.

directory

content

content of interest

bin

executables

startup.sh, shutdown.sh

conf

configuration files

server.xml, context.xml

lib

libraries

none  (driver jars are here, already)

logs

logs

various

webapps

where general apps go

More detail below

wtwebapps

where apps go when using eclipse web tools, by default

Not in use here

work

a working directory

none

1. Set up your shell and environment for topcat

Copy the provided tomcat.bash from $cs636/tomcat.bash to your login directory. 
Edit it to use your own tomcat port instead of 11600.
If you don't have a .profile file in your login directory, create it one with as described in DatabaseSetup.html.
Add one line to the end of your .profile file: ". tomcat.bash".  See ~eoneil/.profile for an example.    
Log out and in again to check everything. 
Use "env" to check that CATALINA_HOME and TOMCAT_URL, etc. are properly defined.

2. Set up a tomcat hierarchy

      cd cs636    
    rm -r tomcat-8.5   
(only if redoing this)
    mkdir tomcat-8.5    
    cd tomcat-8.5    
    unzip $cs636/tomcat-8.5.zip      
($cs636 should expand to /data/htdocs/cs636)
    cd bin     chmod +x *.sh                make sure scripts are executable

This should result in a tomcat-8.5 hierarchy in your course homework directory.  The two top-level directories you'll work in are conf (a little, as described above) and webapps which where all your applications go.  You may also have occasion to look in the logs directory. When you start building web applications, you need to understand the structure of a webapps context subdirectory and how the result is addressed. In general, for an application named, say, myApp, you will establish a directory webapps/myApp, and will be able to address this as http://topcat.cs.umb.edu:<port>/myApp where <port> is the port you will be assigned.See below.

Edit tomcat-8.5/webapps/cs636/index.html to your taste, but make it identify you.  You can see mine at http://topcat.cs.umb.edu:11600/cs636

DO NOT CHANGE PERMISSIONS ON ANYTHING SET UP BY THIS PROCEDURE.

3. Test it all

A. On topcat, use startup.sh to start your tomcat.

B. In a browser, access http://topcat.cs.umb.edu:NNNNN where NNNNN is the first of the port numbers assigned to you. (The second is for tomcat's internal use). It's the one that you changed from 8080 in server.xml. If the browser is outside the departmental firewall, you need a tunnel. It is possible to do the test from a ssh login to topcat by using the text browser lynx:  try “lynx http://localhost:NNNNN” or use “curl http://localhost:NNNNN” to fetch the raw page.
You should see tomcat's distribution home page, including links to samples.

C. Next try http://topcat.cs.umb.edu:NNNNN/cs636. You should see the simple cs636 home page that you tailored.

D. Note that basicjsp/date0.jsp is available in webapps. Try it out at tomcat local path /basicjsp/date0.jsp. Note that this file and the others in this directory need no additional infrastructure in the deployment, such as .jar files, to assist them.

E. SHUT DOWN TOMCAT. DON'T LEAVE A RUNNING TOMCAT WHEN YOU ARE LOGGED OFF.  Use shutdown.sh. Tomcat has been known to cause system performance problems on Linux, probably via memory usage.