CPSC 371 Lab, 5 September 2003
Getting Started with Tomcat
OPTIONAL PRELAB PREPARATION
For development work in this class, you will be working on the Tomcat server. You have the option of running this server on your own computer, if you like. This is not a requirement. The alternative is to run it on one of the Math/CS lab computers. If you choose to run Tomcat on your own computer, you will have to do some setup before the lab on Friday.
We will have lab in the Library Multimedia Lab on Friday. If you are running Tomcat on your own computer, you will need remote access to your computer during the lab. You can use VNC for this purpose. (This will be somewhat experimental -- if it doesn't work, you will work on the CS lab machines instead.) VNC is a cool thing to have around, even if you don't need it for the lab, so you might want to install it anyway.
There are two parts to VNC: a server that makes your Windows desktop remotely accessible, and a client that can be used to contact a computer that is running the server. Both the server and the clients are installed by the same installer. You can find a copy of the installer, named vnc-3.3.7-x86_win32.exe, in the directory at http://math.hws.edu/local/ (accessible from on-campus only). You can also download from the VNC site; see http://www.realvnc.com/download.html.
You can accept all the default settings when you run the VNC installer. After the installation, you will find a "RealVNC" sub-menu in your program menu. This menu contains the basic commands "Run VNC Client" and "Run VNC Server" as well as some other more advanced options.
To test the client, you can try using it to contact one of the Linux computers in the lab. Select "Run VNC Client" from the "RealVNC" menu. A dialog box will pop up where you can specify which computer you want to connect to. You will need something similar to cslab1:50. You can use any of the cslab machines, cslab0, cslab1, ..., cslab13. The 50 is a "port number." You can use either 50 or 51. If you use 50, you will get an 800x600 desktop. A 51 will get you a 1024x768 desktop. You should see the same log-in screen that you get when sitting at the computer in the lab. Used in this way, VNC is an alternative to XWin32.
When you run the VNC server, you make your desktop available to other computers on the network. In Window, unlike in Linux, a client who connects to your computer will see the very same desktop that you see -- if they move the mouse, the mouse will move on your desktop; if they open a window, it opens on your desktop. The remote user has full control of your computer. (It is possible to configure VNC so that is allows observation only, so that clients can see your desktop but not affect it in any way.) Obviously, you want to control access to you computer, so you must specify a password that the remote user will have to give in order to gain access to your machine. The first time you run VNC Server, a dialog box will pop up where you can enter the password and specify certain additional options.
So, select "Run VNC Server" from the "RealVNC" menu. You will see the dialog box mentioned above. Fill in the password you have chosen, and click OK. You will find that a VNC icon has been added to the system tray. As long as this icon is present, VNC is running and remote clients can access to your computer (if they know the password). Right-click the icon, and you will get a menu that will let you terminate the VNC program or reopen the configuration dialog box where the password is set. After the first time you run it, VNC Server will simply add the icon to the system tray, without popping up the configuration dialog.
To get at your machine, a remote user will need to know either the name or the IP address of your computer. Make sure that you have this information before you go on to the next step. (If you give the command netstat -n on the command line, you should be able to find your IP in the second column of the output.)
If you want to test VNC Server, you should go to another computer where you can run the client. For example, you can do this on the Linux machine in the lab. To run VNC viewer in the lab, open a command window and enter the command vncviewer name-or-ip except that you should replace name-or-ip with your computer's name or IP address. This might look for example, like vncviewer 172.25.200.34.
To access your computer during the lab on Friday, leave your computer on, with VNC Server running. Remember your password and your IP address or computer name. If you have not installed the additional software mentioned below, you should also leave the CD from Murach's Java Servlets and JSP in your computer's CD-Rom drive so that you will be able to install the software during the lab.
The server will run on Windows, as long as you have a recent version of Java installed. The version of Java that comes with Windows as part of Internet Explorer is an old version that is not sufficient, so you will need to install a newer Java SDK. A suitable version comes on the CD in Murach's Java Servlets and JSP, or you can download the latest version from java.sun.com. (Be sure to get the SDK, not the JRE.) The installer for version 1.4.1 is also available on the math web server for on-campus access only at http://math.hws.edu/local/j2sdk-1_4_1_05-windows-i586.exe. (Or just go to http://math.hws.edu/local/, and click on the appropriate link.) See page 604--605 of Murach for instructions about setting the Windows PATH variable so that you will be able to use the javac and java commands on the command line.
The Tomcat server is included on the Murach CD. You can find instructions for installing it in Chapter 2 of the book. It would be a good idea to do this before lab. The only glitch is that Tomcat comes in a zip file, which you must unpack. I believe that Windows XP can do this automatically. If you have another version of Windows, you will need an application such as WinZip (www.winzip.com) to unpack the archive.