Web hosting directory, find affordable web hosting
Data recovery software tools & file recovery utilities to recover lost data
WestNIC provides reliable web hosting services
SGD Networks offers Web Hosting, Web Hosting Hyderabad
Award Winning PST Repair and Mail Recovery Software
Apache Tomcat is a Java servlet engine and Java Server Pages processor which can run standalone or integrated with the Apache Web server to serve specific virtual paths. This article explains how to set up Tomcat as a local development server under Windows 95, 98 and ME and integrate it with the Apache Web server.
These instructions are for Tomcat version 3 architecture and are not applicable to the latest version 4 software. Aspects of the environment configuration may be relevant, but should use the equivalent Catalina scripts and variables.
The essential components for installing Tomcat are listed below. The software is all available free of charge and should be installed in the following order:
The installation of the Apache Web server on Windows systems is very simple and well documented. This article assumes you already have the server up and running as http://localhost/ in advance.
It is recommended that the Apache Web server is installed at a path with short directory names and no spaces. For instance, the path c:\apache\httpd will make Tomcat configuration much easier because the MS-DOS path name will be equivalent to the Windows file name.
This article also assumes that you have installed the Java 2 Software Development Kit (SDK) in advance, typically at c:\jdk2.2.1, and that the Java executable is included in the system PATH variable via an autoexec.bat command, see below.
The next step is to run the Tomcat installation program, which will prompt you to confirm an installation directory. As with the Apache Web server, it is recommended that Apache Tomcat is installed at a path with short directory names and no spaces. For instance, the path c:\apache\tomcat will make Tomcat configuration much easier. This path is assumed throughout this article.
The Tomcat user guide and Windows batch files bundled in the Tomcat installation are primarily written for Windows NT server and don't work straight out of the box with Windows 95. Before you edit the following files, save a backup copy for reference.
autoexec.bat
The Tomcat installation includes some batch files to conveniently run and stop Tomcat at c:\apache\tomcat\bin. These batch files set their own CLASSPATH environment variable in addition to any already set via the system autoexec.bat script. It is suggested you configure your own startup settings and pre-configure your environment in advance.
If you have installed the Java Software Development Kit installed, you may already have a Java PATH setting, but Tomcat also requires JAVA_HOME and TOMCAT_HOME environment variables to be set in autoexec.bat. This file is located at the root of your boot disc, commonly c:\autoexec.bat.
The complete example below includes the PATH commands mentioned above for the Java 2 SDK installation and may be copied and pasted if the same paths have been used.
REM Set path for Java Development Kit
SET PATH=C:\jdk1.2.2\bin
REM Set Tomcat home directory
SET TOMCAT_HOME=c:\apache\tomcat
REM Set Java home directory
SET JAVA_HOME=c:\jdk1.2.2
IMPORTANT: The directory paths you specify must point to the locations where you installed Tomcat and the Java Software Development Kit and should not include a trailing slash. You will need to re-start your computer for these settings to take effect.
tomcat.bat
The Tomcat startup scripts make numerous CLASSPATH environment settings when they are run that with standard system configurations will likely produce an Environment out of memory error. The MS-DOS environment must be allocated more Random Access Memory (RAM) to hold all the environment settings.
Right-click over the tomcat.bat script in c:\apache\tomcat\bin, select Properties, click on the Memory tab and adjust Initial environment from Auto to 2816.
When you click OK to complete this change, a Program Information File (PIF) called just TOMCAT will be created to store the memory setting and will act as a "wrapper" around the start-up script itself. This PIF file is the shortcut you should use to run the Tomcat server and should be edited to add the run parameter described below.
run, don't start
The startup.bat batch file supplied with Tomcat is configured to pass the command start to the main script, tomcat.bat, to start Tomcat as a service on Windows NT. This approach does not work with Windows 95, rather Tomcat must be passed a run parameter.
Right-click over the PIF shortcut created in the previous step and click the Program tab. Edit the Cmd line entry to add the run parameter, e.g.
C:\APACHE\TOMCAT\BIN\TOMCAT.BAT run
You may also check the Close on exit box for convenience.
At this point, you can run Tomcat as a standalone server with default configuration by double clicking the TOMCAT shortcut.
server.xml
The main configuration file for Tomcat is the XML file c:\apache\tomcat\conf\server.xml. The Context elements near the end of the file set the working directories for Java Web applications, and the default docBase attributes are webapps/examples, webapps/ROOT and webapps/test, which represent the working directories on the host machine.
The path attribute specifies the virtual path for the URLs in an application. The reloadable attribute indicates whether the server should automatically reload a servlet or JSP if the modified date has changed since the last request. The reloadable attribute would normally set to true for a development environment, and false in a production environment for optimum performance.
To add new application directories, create a new Context element using the same syntax, but use the full Windows path if your working directory is outside the Tomcat installation directory.
<Context
path="/testapp"
docBase="c:\website\servlets"
debug="0"
reloadable="true">
</Context>
The Apache documentation for Web application configuration can be found in c:\apache\tomcat\doc\appdev\index.html. These notes suggest that applications are deployed in a standard format, with all hard coded HTML pages in the root level of the relevant webapps sub-directory with script, stylesheet and image directories beneath that. The application data itself goes in a sub-directory called WEB-INF, but Windows Explorer will not display this directory name accurately in all upper case.
When you first successfully run Tomcat, it will deploy Web Archive (WAR) files in c:\apache\tomcat that unpack to build the three sample applications mentioned above at c:\apache\tomcat\webapps.examples, ROOT and test.
Apache Tomcat will operate as a standalone Web server in its own right and can be configured to serve a full range of Web content, however it is not particularly efficient at serving static Web content. To get Tomcat working with Apache Web server on a Windows installation, one needs to include a Tomcat configuration file reference in the Apache Web server configuration file c:\apache\httpd\conf\httpd.conf. Insert the following line near the end of the configuration file.
Include "c:\apache\tomcat\conf\tomcat-apache.conf"
Since the Tomcat Apache configuration file is generated every time Tomcat starts, Tomcat must be started before Apache Web server and whenever a change to the configuration occurs, when a new context is added.
ApacheModuleJServ.dll
The Tomcat and Apache server partnership requires the addition of the Apache JServ module DLL to "hand-off" HTTP requests to Tomcat. A full Apache JServ installation is not necessary for integration with Tomcat, but for reference see this separate article on working with Apache JServ on Windows95.
The full JServ installation requires the Java Servlet Development Kit (JSDK) 2.0, but this should not be necessary for a minimal Tomcat-only configuration. All one needs is to download is the JServ DLL file, ApacheModuleJServ.dll, which was available separately at the time of writing. If you have the full JServ installation, this file is found in the root installation directory for JServ. Copy ApacheModuleJServ.dll into the Apache Server modules directory.
c:\apache\httpd\modules\ApacheModuleJServ.dll
Now start Tomcat, then start Apache and Apache will adopt virtual paths for all the Web applications defined in the Tomcat server.xml configuration file. As default, all the servlets and JSP installed under c:\apache\tomcat\webapps\ will be available.
For answers to common questions about Tomcat, Java and servlets in general, follow the links below.
Tomcat-Apache service for?
catalina.bat?