Up until last year, we raised each student's disk quota, since tomcat is fairly large (somewhere in excess of 20 megabytes). After discussing this with one of the sysadmins downstairs, we decided not to do that this year, since everyone's quota is already at 125 megabytes, which should be more than adequate. If you hit a wall in terms of disk usage, let me know, and we'll see what we can do.
tar xfz ~karl/public/270/apache-tomcat-5.5.15.tar.gz
This should create the directory apache-tomcat-5.5.15/
ln -s `pwd`/apache-tomcat-5.5.15 ~/tomcat
jsp
applications will be stored:
mkdir ~/webapps mkdir ~/webapps/WEB-INF mkdir ~/webapps/WEB-INF/classes mkdir ~/webapps/WEB-INF/lib
~/tomcat/webapps/ to your
webapps directory. This symlink will be of the form
webapps-username; for example, mine is
webapps-karl:
ln -s ~/webapps ~/tomcat/webapps/webapps-`whoami`
JAVA_HOME to
/usr/java/current In a csh shell,
use
setenv JAVA_HOME /usr/java/current
In the bash shell, use
export JAVA_HOME=/usr/java/current
You'll probably want to also set up JAVA_HOME or other
environment variables automatically when you log in by adding the
above line(s) in your .cshrc file and/or .bashrc
file respectively, depending on whether you use csh and/or bash.
~/tomcat/bin/startup.sh
NOTE: You should shutdown tomcat when you are done using
~/tomcat/bin/shutdown.sh
This frees up the 8080 port for a classmate. Also, you can make
starting up, shutting down, and restarting tomcat easier by putting
the following aliases in .cshrc:
alias sta ~/tomcat/bin/startup.sh
alias shu ~/tomcat/bin/shutdown.sh
alias restart ~/tomcat/bin/shutdown.sh \; ~/tomcat/bin/startup.sh
Then, you will only need to type sta, shu, or restart to have the
desired effect.
cp -r ~karl/public/270/jsp .
This will create a directory called jsp which currently contains two
sub-directories, one called called hello, which contains the Hello
World application I described in class yesterday, and another called
num (which is described later).
make
This will use the GNUMakefile in that directory to install the file
hello.jsp in the directory ~/webapps.
http://localhost:8080/webapps-username/hello.jsp
~/tomcat/logs/
In particular,
~/tomcat/logs/catalina.out
will record output sent to System.out
~/tomcat/work/Catalina/localhost/webapps-username/
tomcat doesn't go
hunting for them on every query.
~/webapps/ is for your
jsp files. You may choose to save them in a subdirectory
to keep webapps/ clean, such as jsp. Depending on
whether you choose to make a jsp directory, the URL to
mywebpage.jsp would be
http://localhost:8080/webapps-username/mywebpage.jsp
or
http://localhost:8080/webapps-username/jsp/mywebpage.jsp
~/webapps/WEB-INF/classes/ is where
you'll save compiled
.class files. Note that class files must be
part of packages, so will be in subdirectories of
classes. For example, the class
edu.gustavus.karl.MyClass will be in
webapps/WEB-INF/classes/edu/gustavus/karl/MyClass.class
~/webapps/WEB-INF/lib/ is for
jar files.
~/tomcat/bin/shutdown.sh ; ~/tomcat/bin/startup.sh
It'll take about 30 seconds to a minute to restart. If you did the
aliases I described above, you will only need to type shu.
~/tomcat/bin/shutdown.sh
or you can choose the brutal but expedient,
killall java
This will kill all java processes you have launched, including tomcat.
num which contains an
application I will explain on Thursday. If you go to that directory
and type ls, you should see 3 files; please read through
them. Observe that the GNUmakefile contains information
(which you can edit) about where the webapp files will be deployed.
GNUmakefile to your liking and then type
make
numguess.jsp in your browser just as you did
for hello.jsp. (You may need to restart tomcat if tomcat
doesn't find it.)
numguess.jsp and
NumberGuessBean.java to try some experiments. For
example, you could, for instance, make the game easy hard-coding your
favorite number as the answer. You could also put change the Bean so
that it outputs the guess by placing a line like
System.out.println("User guessed: " + guess)
in an appropriate place in NumberGuessBean.java. After
running the app, you can inspect the catalina.out file to
trace the guesses.
~/tomcat/webapps/examples/. You should make copies of
the
into source directories, like my num directory, copy the
GNUmakefile and play.
jdbc with mysql, you'll need to
install the appropriate jar file. You may wish to take care of
that now:
cp -r ~karl/public/270/mysql.jar ~/tomcat/common/lib