Slapping Together A JSP Development Environment - Connecting The Dots (
Page 4 of 7 )
In order to get Apache and
Tomcat working together, you need to load the JServ Apache module. Under
Windows, this module is currently named "ApacheModuleJServ.dll", and you need to
place it in the C:\PROGRAM FILES\APACHE GROUP\APACHE\MODULES\ directory. Next,
open up your "httpd.conf" file, and add the following line to the "DSO Support"
section:
LoadModule jserv_module modules/ApacheModuleJServ.dll
This loads the JServ module into memory.
And then
add the following line to the end of "httpd.conf":
Include "c:/tomcat/conf/tomcat-apache.conf"
Each time Tomcat starts, it automatically creates a
configuration file for Apache, customized to your system - this file is named
"tomcat-apache.conf", and is stored in the Tomcat CONF\ directory. This file
contains JServ settings specific to Tomcat, together with directives designed to
help Apache deal with JSP files, and is essential to getting Tomcat and Apache
working together.
If Apache is running, you'll need to stop and restart
it for the new settings to take effect. And if all has gone well, the next time
you start Apache, you'll see something like this:
Apache/1.3.14 (Win32) tomcat/1.0 running...
This indicates that the JServ module has been loaded, and
is available for use with Tomcat.
There is another Windows-specific
problem you might encounter at this stage. If your Tomcat server has been
installed to a directory with a so-called "long" file path, and this long path
contains spaces or strange characters (say, C:\PROGRAM
FILES\TOMCAT\WEBAPPS\EXAMPLES), Apache may barf with a complaint about aliases.
In this case, note the line number with the error, open up the
"tomcat-apache.conf" file, and enclose the long file paths in double quotes to
fix the problem.
Finally, the acid test. Start up Tomcat
C:\TOMCAT\BIN>TOMCAT START
Including all jars in C:\TOMCAT\LIB in your CLASSPATH.
Using CLASSPATH:
C:\TOMCAT\CLASSES;C:\TOMCAT\LIB\ANT.JAR;C:\TOMCAT\LIB\JAXP.JAR;C:\TOMCAT\LIB
\SERVLET.JAR;C:\TOMCAT\LIB\PARSER.JAR;C:\TOMCAT\LIB\WEBSER~1.JAR;C:\TOMCAT\L
IB\JASPER.JAR;C:\JDK\LIB\TOOLS.JAR
Starting Tomcat in new window
2001-01-30 02:47:19 - ContextManager: Adding context Ctx( /examples )
2001-01-30 02:47:19 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2001-01-30 02:47:20 - ContextManager: Adding context Ctx( )
2001-01-30 02:47:20 - ContextManager: Adding context Ctx( /test )
2001-01-30 02:47:22 - PoolTcpConnector: Starting HttpConnectionHandler on
8080
2001-01-30 02:47:22 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
8007
Then start up Apache.
Apache/1.3.14 (Win32) tomcat/1.0 running...
And point your browser to
http://localhost/examples/jsp/hello.jsp. If Tomcat, Apache and JServ are all
configured properly, your JSP page should be parsed by the Tomcat engine and
returned correctly to the browser. You can now use Apache to serve JSP documents
without the necessity of specifying the port number in the URL.
In case
you need to stop the Tomcat server, you can use
C:\TOMCAT\BIN>TOMCAT STOP
Including all jars in C:\TOMCAT\LIB in your CLASSPATH.
Using CLASSPATH:
C:\TOMCAT\CLASSES;C:\TOMCAT\LIB\ANT.JAR;C:\TOMCAT\LIB\JAXP.JAR;C:\TOMCAT\LIB
\SERVLET.JAR;C:\TOMCAT\LIB\PARSER.JAR;C:\TOMCAT\LIB\WEBSER~1.JAR;C:\TOMCAT\L
IB\JASPER.JAR;C:\JDK\LIB\TOOLS.JAR
Stop Tomcat