Tomcat 4.1.x and IIS 5 on Windows/2000 with mod_jk2.dll
IIS 5 comes with Windows/2000 Professional Edition. Since it is "free" and a part of Microsoft, many organizations simply select that as the web server of choice. I will not get into political discussions in this document, other than to note that the Apache httpd server runs on the majority of servers present on the Internet.
That being said, sometimes it is necessary to support configurations for political, cultural, or legacy reasons. This portion of the document shows how to connect a stock IIS 5 to Tomcat 4.1.x using isapi_redirector2.dll.
The isapi_redirector2.dll referenced in this discussion was downloaded from:
http://apache.mirrors.pair.com/jakarta/tomcat-connectors/jk2/binaries/win32/
%CATALINA_HOME% refers to the root directory of the Tomcat 4.1.xx installation (which is C:\Tomcat for this machine).
I realize that the Windows default is to place all programs in { { { %SystemDrive%\Program Files } } }. Personally, I think putting a command delimiter (space) in the name of a directory or file is not very useful. Even Windows/2000 doesn't handle this issue in a consistent manner. In short, I recommend to NOT place the Tomcat 4.1.x server in Program Files.
1. Copy isapi_redirector2.dll to a reasonable location. While my
{{{ configuration uses %CATALINA_HOME%\bin\win32, this may not be
optimum since the bin directory gets overwritten during a Tomcat
upgrade. 2. Make sure isapi_redirector2.dll can be read by System 3. Create a jk2.properties file with the following information
{{{ #
- # Socket configuration # handler.list=request,container,channelSocket # # socket configuration # channelSocket.port=8009 channelSocket.address=127.0.0.1 channelSocket.maxPort=port+10 }}}
4. Place this file in %CATALINA_HOME%\conf 5. Make sure this file is readable by System 6. Create a jk2.workers file with the following information.
{{{ #
- # basic workers2.properties file # # # shared memory #
- ["shm"]
- file=C:/Apache2/logs/shm.file size=1048576 # # alternate logging to keep mod_jk2 logging separate from # IIS logging #
[logger.file:0] file=${serverRoot}/logs/jk2.log [workerEnv:] info=Global server options timing=1 debug=0
logger=logger.file:0 # # IP socket channel # [channel.socket:localhost:8009] port=8009 host=127.0.0.1 # # define the ajp13 worker # [ajp13:localhost:8009] channel=channel.socket:localhost:8009 # # Uri mapping examples - jsp files only # [uri:/examples/*.jsp] worker=ajp13:localhost:8009 # # Uri mapping examples - all servlets # [uri:/examples/servlet/*] worker=ajp13:localhost:8009
- file=C:/Apache2/logs/shm.file size=1048576 # # alternate logging to keep mod_jk2 logging separate from # IIS logging #
- }}}
NOTE:I keep configuration files and shared memory files in %APACHE_HOME%, since I normally run Apache 2.0.x. Keeping them in another (safe) location is certainly an option.
7. Edit the registry and create the following entry in
{{{ HKEY_LOCAL_MACHINE
SOFTWARE
Apache Software Foundation - Jakarta Isapi Redirector\2.0
- serverRoot C:\Tomcat extensionUri /jakarta/isapi_redirector2.dll workersFile C:\Apache2\conf\workers2.properties logLevel INFO
- }}}
NOTE: Change the serverRoot value to reflect your installation. It should be the same as %CATALINA_HOME%. Change the workersFile location to reflect your installation. The completed entry will look like the png image (to be provided).
8. Use the IIS management console to add a new virtual directory with
{{{ the name of jakarta. 9. The physical path must be the directory where you copied isapi_redirector2.dll. My location is C:\Tomcat\bin\win32 10. Mark the directory with execute access. The end result is shown in the png image (to be provided). 11. Right mouse button on the web site, and select properties from the drop-down menu. 12. Select the ISAPI Filters tab and add isapi_redirector2.dll as a filter. Call it jakarta. See the two images (to be provided). 13. In the Documents tab, add index.html and index.jsp as default files to serve when entering a directory. See the image (to be provided). 14. Add a virtual directory for /examples and point it to {{{ %CATALINA_HOME%\webapps\examples. This will enable IIS to serve
- static information in those directories. See the image (to be provided). }}}
15. Create the shm.file file. One way to do this is by opening up a {{{ DOS window and doing the following:
COPY CON: > shm.file (a few blank lines) ^Z }}}
16. Make sure that the shm.file file is rw for System. 17. Shut down the IIS 5 web server using Services, NOT the management console. 18. Shut down the Tomcat 4.1.x server 19. Start the Tomcat 4.1.x server 20. Verify that it is running by browsing http://localhost:8080 21. Start the IIS 5 web server 22. Open the IIS management console, right mouse click on the entire web site and select Properties from the drop down menu. 23. Verify that a green up arrow appears next to the jakarta ISAPI filter. See the image (to be provided). 24. Verify the connection by browsing the following:
{{{ http://localhost/examples/jsp
http://localhost/examples/jsp/dates/date.jsp http://localhost/examples/servlets/ http://localhost/examples/servlet/HelloWorldExample }}}
25. Compare the results to the following:
{{{ http://localhost:8080/examples/jsp
http://localhost:8080/examples/jsp/dates/date.jsp http://localhost:8080/examples/servlets/ http://localhost:8080/examples/servlet/HelloWorldExample }}}
26. If they are the same, you have Tomcat 4.1.x talking to IIS {{{ 5.
- }}}
Alternative method
There is a setup http://www.shiftomat.com/opensource/ that does all that for you.