Please send questions to
st10@humboldt.edu .
How to make a SIMPLE SERVLET on sorrel
----------------------------------------------
(for CIS 480 - Advanced Java - May 2001)
* go to sorrel, and add to the END of your .cshrc file:
setenv ORACLE_HOME /home/univ/oracle/products/w4.0.8
setenv ORAWEB_HOME /home/univ/oracle/products/w4.0.8/ows/4.0
setenv JAVA_HOME $ORAWEB_HOME/jdk
# this is ALL ONE LINE, note --- do not let the \'s fool you!!!
setenv CLASSPATH "$CLASSPATH":$JAVA_HOME/lib/classes.zip:$ORACLE_HOME/ows/cartx/jweb/classes/jweb.jar:$ORACLE_HOME/ows/cartx/jweb/classes/jservlet.jar:$ORACLE_HOME/orb/4.0/classes/yoj.jar:$ORAWEB_HOME/classes/cosnam.jar
setenv LD_LIBRARY_PATH $ORAWEB_HOME/../cartx/jweb/lib
setenv THREADS_FLAG native
* type
source .cshrc
...to make the above execute, or log out and log in again.
* In some (protected) directory of your choice, type and compile your
servlet.
* NOTE --- because of how servlets are currently set
up on sorrel, everyone's servlets need to have unique
names. So, we'll make the class standard to start your
servlet's names with your username (so, mine will be
st10HelloServlet, etc.)
* compile it there in the usual way.
* copy the resulting .class file to some world-executable
directory of your choice --- your home directory should be fine,
or a servlets directory if you prefer, etc.
* make the copy of your .class file world-readable and
world-executable:
chmod 755 abs13ServletName.class
* Either create a web page that will call this servlet (see
~st10/public_html/cis480j/st10GreetMe.html
for an example), or call it directly using a URL such as
(assuming that the servlet is in your home directory!):
http://sorrel.humboldt.edu:8895/jserv/abc13/abc13GreetMe
* two points: first, if you are on-campus, you can
use "sorrel" instead of all of "sorrel.humboldt.edu".
Second, if you want to run a faculty member's servlet,
you must use:
jservf
...in the URL, instead of jserv. So, if you want to try
to run my example servlet st10GreetMe, use:
http://sorrel.humboldt.edu:8895/jservf/st10/st10GreetMe?username=nameDesired
* now try it --- use the servlet's URL, or bring up the web page with
the link to your servlet, and try it; wait, and hope, but, at least some of
the time --- it works! Thank you, Peter Johnson!
* possibly-helpful hints:
* if you get a "Session expired" screen: just try again.
* if you are having problems with "old" servlet code
being run instead of a "new" version:
* the software helping to run our servlets is the
OAS (Oracle Application Server).
* This problem is actually related to a servlet feature:
once a servlet is started up, it keeps running for a
while, accepting additional requests as they come in
(so that one servlet can serve many requests).
* However, this is a problem if you have recompiled
a servlet and want to run the new version --- the old,
running version gets in the way.
* So, Peter Johnson has tweaked the OAS so that,
at each 5-minute interval on the clock, all servlets
are reset.
* You can use the "date" command to see how far you
are from the next reset...
* *IF*, after a 5-minute 'tick', the problem seems
to persist, Prof. Burroughs has found it useful to:
* remove the .class file completely,
* *try* to run the servlet (so that the
OAS sees that it cannot find it)
* put the .class file back
* try to run it again.