Software Development: Apache Tomcat

We will use Apache Tomcat as our webserver that implements the Java Servlet and JSP technologies. Be certain to download the current stable version of Tomcat 6.x. Since Tomcat is a Java application, it should run out of the box provided you have already installed Java on your system. However, there are a few details to be sure of:   It appears that you can run Tomcat as a daemon (Unix-based systems) or a Windows Service (Windows). I recommend doing neither. Just download either the ZIP or tar file for the binary installation and unpack. You will run Tomcat as an ordinary user process, starting and stopping it as needed.   Make sure to start Tomcat with the

(Unix-based systems) or  (Windows) scripts, which are located in the  directory of your installation. Likewise shut Tomcat down with  or.   Permissions. Tomcat looks for webapps, writes log files, etc., in various subdirectories of the environment variable. If you do not set this yourself, then /

will set it to the installation directory for your Tomcat installation. Thus, you need to make sure that you have write permission on these directories.   You should configure Tomcat Manager so that once you have started Tomcat, you can start, stop, and reload web applications without restarting the server. See the "Configuring Manager Application Access" subsection of the Manager section of the on-line documentation. You want to follow the instructions for the "MemoryRealm."   Since we will use the JSTL in our projects, and we don't want to include a copy of it in every web app we write, you must install the Jakarta implementation of JSTL 1.1 into Tomcat itself. To do so:   Download the Jakarta Taglibs implementation by following the "Downloads" link, then selecting "Standard 1.1 Taglib," and then download either the or  binary distribution.

  Unpack the downloaded file and copy the two JAR files in the subdirectory to the  subdirectory of your Tomcat installation.   I recommend renaming the JAR files when you copy them to something like  where   is the original name, so that it is clear what these JAR files are doing in your Tomcat installation.

</li> </ol> This JSTL implementation will be available to all web apps upon the next restart of Tomcat. </li>  Using Tomcat on :  This takes a little bit of care, because we want to be sure that all students can run Tomcat without interfering with each other. Here is what you need to do to set things up: <ol>  In, create   and the following subdirectories: ,  ,  ,

, and. </li>  Copy , , and to your directory.

<ol>  Edit  as follows. Search for the string ; it should appear in a block that looks like: &lt;Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /&gt; Ask Norman what number to use for the port instead of. This is important; if two users attempt to run Tomcat and both have it talking to port, everybody is likely to be unhappy.

</li>  Edit  to add a better username and password to the manager account if you like. </li> </ol> </li>  Edit your  to set the following two environment variables: export JAVA_HOME=/opt/jdk1.6.0_07 export CATALINA_BASE=$HOME/comp342/apache-tomcat-6.0.18

Here I am assuming that your  directory is in fact  ; change the definition of  accordingly if this is not the case. </li>  You can now start and stop Tomcat with the commands and. If those commands are not found, edit your  file to put

in your path (see above). </li> </ol> </li> </ul>