Man, this class is pretty!

T540 Spring Semester 2002


Lecture Notes Sixteen: Server-side Java

Create a folder where you will install tomcat.

burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/tomcat
burrowww.cs.indiana.edu% 
Go there, and copy it from my public directory.

burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/tomcat
burrowww.cs.indiana.edu% cp /u/dgerman/public/jak*.zip . 
burrowww.cs.indiana.edu% ls -l
total 5160
-rw-r--r--   1 dgerman  faculty   5275338 Mar  7 12:09 jakarta-tomcat-4.0.3.zip
burrowww.cs.indiana.edu% 
Unzip it, and you're almost done.

unzip *.zip
Check your quota, remove the archive.

  ... 

  inflating: jakarta-tomcat-4.0.3/RELEASE-NOTES-4.0-B2.txt  
  inflating: jakarta-tomcat-4.0.3/RELEASE-PLAN-4.0.txt  
  inflating: jakarta-tomcat-4.0.3/RELEASE-PLAN-4.0.1.txt  
  inflating: jakarta-tomcat-4.0.3/RUNNING.txt  
burrowww.cs.indiana.edu% quota -v
Disk quotas for dgerman (uid 10867):
Filesystem     usage  quota  limit    timeleft  files  quota  limit    timeleft
/nfs/paca/home/user1
               94490 100000 102400               2766      0      0            
burrowww.cs.indiana.edu% ls -ld *
drwxr-xr-x  11 dgerman  faculty      1024 Mar  1 14:49 jakarta-tomcat-4.0.3
-rw-r--r--   1 dgerman  faculty   5275338 Mar  7 12:09 jakarta-tomcat-4.0.3.zip
burrowww.cs.indiana.edu% rm *.zip
burrowww.cs.indiana.edu% quota -v
Disk quotas for dgerman (uid 10867):
Filesystem     usage  quota  limit    timeleft  files  quota  limit    timeleft
/nfs/paca/home/user1
               89330 100000 102400               2765      0      0            
burrowww.cs.indiana.edu% 
For reference, latest version of Tomcat is always available here.

Let's now configure our server.

(Notice the folder where you need to go to, first.)

burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/tomcat/jakarta-tomcat-4.0.3/conf
burrowww.cs.indiana.edu% ls -l
total 67
-rw-r--r--   1 dgerman  faculty      6689 Mar  1 14:48 catalina.policy
-rw-r--r--   1 dgerman  faculty     11819 Mar  1 14:48 server-noexamples.xml.config
-rw-r--r--   1 dgerman  faculty     16079 Mar  1 14:48 server.xml
-rw-r--r--   1 dgerman  faculty       450 Mar  1 14:48 tomcat-users.xml
-rw-r--r--   1 dgerman  faculty     31554 Mar  1 14:48 web.xml
burrowww.cs.indiana.edu% cp server.xml server.xml.backup
burrowww.cs.indiana.edu% emacs server.xml
burrowww.cs.indiana.edu% diff server.xml server.xml.backup
54c54
<     <!-- Define a non-SSL HTTP/1.1 Connector on port 36120 -->
---
>     <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
56c56
<                port="36120" minProcessors="5" maxProcessors="75"
---
>                port="8080" minProcessors="5" maxProcessors="75"
334d333
< 
burrowww.cs.indiana.edu% 
Do the same, by using a port with the number 36xxx + 120 (twenty).

Now we need to set a few environment variables.

setenv JAVA_HOME   /l/jdk

setenv CATALINA_HOME /u/dgerman/tomcat/jakarta-tomcat-4.0.3
Make the change in ~/.cshrc, source it, then test:

burrowww.cs.indiana.edu% echo $JAVA_HOME
/l/jdk
burrowww.cs.indiana.edu% echo $CATALINA_HOME
/u/dgerman/tomcat/jakarta-tomcat-4.0.3
burrowww.cs.indiana.edu%
Now start your server.

burrowww.cs.indiana.edu% $CATALINA_HOME/bin/startup.sh
/u/dgerman/tomcat/jakarta-tomcat-4.0.3/bin/startup.sh: Permission denied
burrowww.cs.indiana.edu% chmod 700 $CATALINA_HOME/bin/*.sh 
burrowww.cs.indiana.edu% $CATALINA_HOME/bin/startup.sh           
Using CATALINA_BASE:   /nfs/paca/home/user1/dgerman/tomcat/jakarta-tomcat-4.0.3
Using CATALINA_HOME:   /nfs/paca/home/user1/dgerman/tomcat/jakarta-tomcat-4.0.3
Using CATALINA_TMPDIR: /nfs/paca/home/user1/dgerman/tomcat/jakarta-tomcat-4.0.3/temp
Using JAVA_HOME:       /l/jdk
burrowww.cs.indiana.edu% 
Then try it (at 36xxx + 120).

For me this is right here.

Here, in fact are all our servers:


201,BL,1255,36000,Last Name, First Name    ,dgerman      ,INDIANA.EDU
201,BL,T540,36084,Baumgartner, Jason       ,jlbaumga     ,INDIANA.EDU
201,BL,T540,36085,Cincotta, Nicholas       ,ncincott     ,INDIANA.EDU
201,BL,T540,36086,Ehrlichman, Wesley       ,wehrlich     ,INDIANA.EDU
201,BL,T540,36087,Fleetwood, Joshua        ,jfleetwo     ,INDIANA.EDU
201,BL,T540,36088,Fox, John                ,jffox        ,INDIANA.EDU
201,BL,T540,36089,Friend, Christopher      ,cmfriend     ,INDIANA.EDU
201,BL,T540,36090,Hall, Christopher        ,cmhall       ,INDIANA.EDU
201,BL,T540,36091,Heald, David             ,dheald       ,INDIANA.EDU
201,BL,T540,36092,Keese, Brian             ,bkeese       ,INDIANA.EDU
201,BL,T540,36093,Lewis, Megan             ,meblewis     ,INDIANA.EDU
201,BL,T540,36094,Lu, Nan                  ,nlu          ,INDIANA.EDU
201,BL,T540,36095,Polit, Gregory           ,gpolit       ,INDIANA.EDU
201,BL,T540,36096,Rauscher, Andrew         ,arausche     ,INDIANA.EDU
201,BL,T540,36097,Scott, Thomas            ,thscott      ,INDIANA.EDU
201,BL,T540,36098,CHONG, Ji Young          ,jchong       ,INDIANA.EDU
201,BL,T540,36099,Pernice, Wolfram         ,wpernice     ,INDIANA.EDU
201,BL,T540,36109,Jin, Ying                ,yinjin       ,INDIANA.EDU
201,BL,T540,36111,Gillespie, Thom          ,thom         ,INDIANA.EDU
  
Make a change to your Tomcat's home page.

burrowww.cs.indiana.edu% cd $CATALINA_HOME/webapps/ROOT 
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/tomcat/jakarta-tomcat-4.0.3/webapps/ROOT
burrowww.cs.indiana.edu% emacs index.html 
burrowww.cs.indiana.edu% 
Take a look at the servlet examples.

Here's where they are located on your server.

burrowww.cs.indiana.edu% cd $CATALINA_HOME
burrowww.cs.indiana.edu% cd webapps/examples/WEB-INF/classes
burrowww.cs.indiana.edu% ls
CookieExample.class         RequestInfoExample.java    colors
CookieExample.java          RequestParamExample.class  compressionFilters
HelloWorldExample.class     RequestParamExample.java   dates
HelloWorldExample.java      SendMailServlet.java       error
JndiServlet.class           SessionExample.class       examples
JndiServlet.java            SessionExample.java        filters
LocalStrings.properties     SnoopServlet.class         listeners
LocalStrings_en.properties  SnoopServlet.java          num
LocalStrings_es.properties  TroubleShooter.class       servletToJsp.class
RequestHeaderExample.class  TroubleShooter.java        servletToJsp.java
RequestHeaderExample.java   cal                        sessions
RequestInfoExample.class    checkbox                   validators
burrowww.cs.indiana.edu%
You may also need to change your CLASSPATH environment variable as follows.

burrowww.cs.indiana.edu% echo $CLASSPATH
.:/u/dgerman/tomcat/jakarta-tomcat-4.0.3/common/lib/servlet.jar
burrowww.cs.indiana.edu%
You may also create a few other shortcuts: For the rest of the lecture we will use a combination of existing notes.

There will be a few other things that we will touch on, as well.

Here's a quick problem.


Last updated: Mar 7, 2002 by Adrian German for A348/A548