After many headaches of the install I didn't want this little piece of knoledge to go to waste - it may help someone, somewhere.
==========================================================
February 7, 2002
Configuring Apache to use the Tomcat JSP/Servlet Container Using the mod_webApp Connector
This document details how to configure Tomcat 4.0.1 with Apache Web Server v1.3.23 on a Windows 2000 platform.
[* ! *] Important note: Using the mod_webApp connector under a Windows environment has proven to be flaky. Specifically, an error like the following has been reported:
WebApp: Error 500
(File: pr_warp.c Line: 434)
(null)
Please send me your comments to baden@pmcanada.com
You may be aware of a few modlues such as mod_jk and mod_webapp. The mod_jk package makes use of $TOMCAT_HOME/conf/worker.properties, which is not created by Tomcat 4, and needs to be created manually.
First we need to configure Tomcat. You may have to add the following lines after the last </Service> tag in $CATALINA_HOME/conf/server.xml:
# =================== C U T =================
<!-- The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat 4.0
as its servlet container. Please read the README.txt file coming with
the WebApp Module distribution on how to build it.
(Or check out the "jakarta-tomcat-connectors/webapp" CVS repository)
To configure the Apache side, you must ensure that you have the
"ServerName" and "Port" directives defined in "httpd.conf". Then,
lines like these to the bottom of your "httpd.conf" file:
The next time you restart Apache (after restarting Tomcat, if needed)
the connection will be established, and all applications you make
visible via "WebAppDeploy" directives can be accessed through Apache.
Refer to http://dcb.sun.com/practices/howtos/tomcat_apache.jsp for additional help.
-->
<!-- Define an Apache-Connector Service -->
<Service name="Tomcat-Apache">
<Connector className=
"org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="10" debug="0"/>
<!-- Replace "localhost" with what your Apache "ServerName" is set to -->
<Engine className=
"org.apache.catalina.connector.warp.WarpEngine"
name="localhost" debug="0" appBase="webapps">
<!-- Global logger unless overridden at lower levels -->
<Logger className= "org.apache.catalina.logger.FileLogger"
prefix="apache_log." suffix=".txt" timestamp="true"/>
<!-- Because this Realm is here, an instance will be shared globally -->
<Realm className="org.apache.catalina.realm.MemoryRealm" />
</Engine>
</Service>
# =================== C U T =================
Refer to http://dcb.sun.com/practices/howtos/tomcat_apache.jsp for additional help.
#########################
The mod_webapp Connector
#########################
Next, locate the file íºwebapp-module-1.0-tc40í¿ íV http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.1/bin/win32/webapp-module-1.0-tc40-windows.zip
*** Refer to the enclosed install.txt for additional assistance.
Copy the mod_webapp.so and the libapr.dll file you will find in this into $APACHE_HOME/modules.
Add the following directives. For Windows your "LoadModule" directive looks like (in httpd.conf):
This should go in the section that contains (around line 185):
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule status_module modules/mod_status.so
#LoadModule info_module modules/mod_info.so
The directive should look like this:
#Directive descriptioníK
LoadModule webapp_module modules/mod_webapp.so
Next, down at around line 250:
#AddModule mod_usertrack.c
#AddModule mod_unique_id.c
AddModule mod_so.c
AddModule mod_setenvif.c
The following directive should be added:
#Directive description
AddModule mod_webapp.c
As install.txt indicates, commenting out the AddModule line may fix a problem experienced when loading the server, although the configtest option will return the line number in the configuration file where the error was encountered.
Next, run a syntax check to ensure that these configurations work with Apache:
$APACHE_HOME/apache -t
íº$APACHE_HOME/conf/httpd.conf: Syntax OKí¿ return value should be returned, indicating that the configuration is correct.
Now, start adding the web application connections and context into the Apache configurations.
Back to the "httpd.conf" file. Locate the section where the <IfModule > starts.
Somewhere after a <IfModuleíK>íK</IfModuleíK> block add the following block:
<IfModule mod_webapp.c>
WebAppConnection warpConnection warp localhost:8008
WebAppInfo /webapp-info
WebAppDeploy examples warpConnection /examples
WebAppDeploy webdav warpConnection /webdav
WebAppDeploy tomcat-docs warpConnection /tomcat-docs
</IfModule>
The IfModule directive can be omitted.
Tomcat has a /manager command to load and unload servlets, etc., and list what is loaded in its environment. A WebApp cannot be created for this, ie:
WebAppDeploy manager warpConnection /manager
It will authenticate on whatever realm it is setup with, but will return a server error after this.
The JSP/Servlet container (Tomcat) should be listening on the port specified in the socket íºlocalhost:xxxxí¿. The webApp connects requests to this port. This is not the http port, it is the port that the WARP connector is listening on, as specified in $CATALINA_HOME/conf/server.xml.
Run $APACHE_HOME/apache -t again to make sure that there are no errors with httpd.conf.
*** We can add a virtual host for this, which is entirely optional.
Create a new virtual host by adding the line:
äh NameVirtualHost 127.0.0.1:80
- instead of the loopback address, insert whatever IP address you are using.
Next we need to define that virtual host by adding the following:
<VirtualHost 127.0.0.1>
ServerName crystal
DocumentRoot "C:/JAVADEV/Apache Group/Apache Tomcat 4.0/x"
WebAppConnection warpConnection warp localhost:8008
WebAppDeploy examples warpConnection /examples
ErrorLog logs/warpConnection-error_log.txt
</VirtualHost>
Run $APACHE_HOME/apache -S (it must be a capital "S") to view the virtual-host configuration, and ensure there are no problems.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.