IIS and Tomcat - how to configure to work together

By: Emiley J. Viewed: 153509 times  Printer Friendly Format    


This tutorial explains how to configure your IIS (in this example IIS 5.0, since I have not upgraded yet) and Tomcat 4.1 xxx version (again since I have not upgraded yet). But the concept should be the same. So if you want to host some JSP files or servlets on your Tomcat which is installed in port 8080 and your IIS is installed on the same machine at port 80 and you want to direct all JSP files also to port 80 so that IIS can forward these queries to tomcat internally and respond. So the user does not have to type 8080 on the url. Well if you want to do that then these are the steps.

INSTALL IIS REDIRECTOR FOR TOMCAT: 

A. In Windows Explorer, navigate to <drive>:\Tomcat4112\bin. 

B. Within the 'bin' folder, create a new folder and name it 'win32'. 

C. Download the isapi_redirector.dll. file. (search the net for this file and you can download)

D. Save the isapi_redirector.dll file into <drive>:\Tomcat4112\bin\win32. 

Note that the spelling of the required file is isapi_redirector.dll. Jakarta-Tomcat 3.x.x used a different file called isapi_redirect.dll; this file is not compatible.


DOWNLOAD PROPERTIES FILES: 

E. Download the worker.properties file. 
(you can search the net to get a sample)

F. Open an empty document in Notepad. Copy and paste the contents of the worker.properties file into the empty document. 
 

You must use Notepad to edit the properties files. Using other text editors for this step may cause a '404 Error, File not found' later in the installation.


G. Ensure that the 'java_home' and 'tomcat_home' variables have been set correctly. For example: 

worker.tomcat_home=<drive>:\Tomcat4112

worker.java_home=<drive>:\j2sdk1.4.0

 Ensure that these paths accurately reflect your current set-up environment.


H. Save the file in <drive>:\Tomcat4112\conf folder as "worker.properties", quotes included, and specify 'All File Types' before saving. 

I. Download the uriworkermap.properties file. 
(search the net for a sample)

J. Open an empty document in Notepad. Copy and paste the contents of the uriworkermap.properties file into the empty document. 

Again, you must use Notepad to edit the properties files. Using other text editors for this step may cause a '404 Error, File not found' later in the installation.


K. Save the file in <drive>:\Tomcat4112\conf folder as "uriworkermap.properties", quotes included, and specify 'All File Types' before saving. 

MODIFY WEB.XML FILE 

L. In Windows, navigate to drive>:\Tomcat4112\conf, and open the file 'web.xml' in a text editor. 

M. Search for the following text: 

    <!-- The mapping for the invoker servlet -->

<!--

<servlet-mapping>

    <servlet-name>invoker</servlet-name>

    <url-pattern>/servlet/*</url-pattern>

</servlet-mapping>

-->

N. Delete the comment lines "<!--" and "-->", so the code looks as follows: 

    <!-- The mapping for the invoker servlet -->



<servlet-mapping>

    <servlet-name>invoker</servlet-name>

    <url-pattern>/servlet/*</url-pattern>

</servlet-mapping>




O. Save the file, and exit. 

CREATE JAKARTA VIRTUAL DIRECTORY: 

Q. Open Internet Services Manager. 

R. In the left panel of the Console, under Internet Information Services, expand the contents for your "*host" machine name. 

S. Right-click 'Default Web Site' and select New > Virtual Directory. This opens the Virtual Directory wizard. Continue as follows: 
S1. Click Next to continue. 
S2. In the Alias box, type 'Jakarta' and click Next. 
S3. For Directory, browse to: <drive>:\Tomcat4112\bin\win32, click OK, then click Next. 
S4. Check the box to give the permissions: Execute (such as ISAPI applications or CGI).
S5. Click Finish. 

T. Right-click 'Default Web Site' and select Properties. Continue as follows: 
T1. In the dialog box, select the 'ISAPI Filters' tab. 
T2. Click Add. 
T3. In the Filter Properties dialog box, enter the Filter Name such as Jakarta. 
T4. For the Executable, browse to <drive>:\Tomcat4112\bin\win32\isapi_redirector.dll and click OK. 
T5. Click Apply and close the Default Web Site Properties dialog box. 

U. Stop and Start IIS, ensuring that the Default Web Site is selected. 

V. Return to the ISAPI Filters tab and ensure that there is a green, upward arrow next to the Jakarta filter. Close Internet Services Manager. 

If there is not a green arrow next to Jakarta filter, try stopping and re-starting the 'IIS Admin Service', including the WWW Publishing Service, from the Services panel. If the Jakarta filter still fails, do not proceed further. Go back and check the registry entries created in Step G.

VERIFY TOMCAT INSTALLATION: 

W. Open the Services panel. Select the Apache Tomcat 4.1 service from the list and start it, if not already started. 

X. Enter the following into a browser. Note: This is case sensitive. 

http://<your_machine_name>/examples/servlet/HelloWorldExample

A page should display that says "Hello World" if the test is successful. 

If this test fails, recheck your installation steps. You may find that this URL works if you specify 'port 8080'. This only indicates that the Tomcat web server is working; the required redirect to IIS is failing.


Most Viewed Articles (in JSP )

Latest Articles (in JSP)

Comment on this tutorial