Using Tomcat with IIS
A HowTo for integrating Apache Tomcat with Microsoft IIS
Contents
1. General Information
The task at hand is to convince IIS to receive HTTP requests, pass them on to Tomcat and reply accordingly to the client.
Generally the steps to do are:
- Installation of IIS redirector
- Configuration of Tomcat properties files (workers.properties and uriworkermap.properties in $TOMCAT_HOME$/conf)
- Configuration of Windows Registry (set some registry values)
- Configuration of IIS (Some work with the IIS management console)
2. Installation of IIS redirector
This is simple. Download isapi_redirect installer from http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.15/isapi_redirect.msi and install it to $TOMCAT_HOME$/.. (same directory level as 'Tomcat 5.5', e.g. D:\Programme\Apache Software Foundation\Jakarta Isapi Redirector). This directory will from now on be called $ISAPI_REDIRECTOR_HOME$
The directory structure should look like in the following:
3. Configuration of tomcat properties files
In $ISAPI_REDIRECTOR_HOME$/conf two files have to be adjusted:worker.properties.minimal and uriworkermap.properties.
workers.properties.minimal (only adjust if you use non-standard ports for Tomcat
worker.list=wlb,jkstatus # Defining a worker named ajp13w and of type ajp13 # Note that the name and the type do not have to match. # Port number has to be set right (to port where AJP/13 connector is defined in server.xml) worker.ajp13w.type=ajp13 worker.ajp13w.host=localhost worker.ajp13w.port=8009 # Defining a load balancer worker.wlb.type=lb worker.wlb.balance_workers=ajp13w # Define status worker worker.jkstatus.type=status
uriworkermap.properties
At this point, the particular servlets (the virtual directories of Tomcat) are set up to the worker of the worker.properties. The syntax for this is: /path/*=workername.
/igeoportal/*=wlb # # Mount jkstatus to /jkmanager # For production servers you will need to # secure the access to the /jkmanager url # /jkmanager=jkstatus
To test the (not yet at - there is still some work to do) configuration, IIS and Tomcat have to run. Only the directories / servlets that are set up in Tomcat's server.xml and the uriworkermap.properties can be requested.
4. Configuration of Windows Registry
(this step is possibly already done by the ISAPI Redirector installer)
Now some registry values have to be set (using "regedit"):
[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation] [HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector] [HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0] "extension_uri"="/jakarta/isapi_redirect.dll" "log_file"="D:\\Programme\Tomcat 5.5\\logs\\isapi.log" "log_level"="error" "worker_file"="D:\\Programme\Tomcat 5.5\\conf\\workers.properties.minimal" "worker_mount_file"="D:\\Programme\Tomcat 5.5\\conf\\uriworkermap.properties"
Here is a screenshot depicting these:
5. Configuration of IIS
- Open the Internet Information Services (IIS) Management Console.
- In the left panel of the Console, under Internet Information Services, expand the contents for the 'host' machine name.
Right-click 'Default Web Site' (German: 'Standardwebsite') and select New > Virtual Directory. This opens the Virtual Directory wizard. Continue as follows: -> Click Next to continue. ->. In the Alias box, type 'Jakarta' and click Next. ->. For Directory, navigate to: $ISAPI_REDIRECTOR_HOME$\bin, click OK, then click Next. ->. Check the box to give the permissions: Execute; for example, ISAPI applications or CGI. ->. Click Finish.
Right-click 'Default Web Site' and select Properties. Continue as follows: ->. In the dialog box, select the 'ISAPI Filters' tab. ->. Click Add. ->. In the Filter Properties dialog box, enter the Filter Name: Jakarta. ->. For the Executable, navigate to: $ISAPI_REDIRECTOR_HOME$\bin\isapi_redirect.dll and click OK. ->. Click Apply and close the Default Web Site Properties dialog box.
Add a Web Service Extension for Jakarta. ->. Right-Click on Web Service Extensions and choose 'Add a new Web service extension'. ->. Type 'Jakarta' for the Extension name. ->. Click Add and navigate to: $ISAPI_REDIRECTOR_HOME$\bin\isapi_redirect.dll. Click OK. ->. Check 'Set extension status to Allowed' and click OK to close the dialog box.
- Stop and restart the Default Web Site by selecting it (it should already be selected from previous steps), then clicking the Stop and Start buttons in the toolbar.
Now you should test if the integration works.
For the changes to take effect it is necessary to restart Tomcat (the usual way) and IIS. To be sure IIS is properly stopped and restarted use the following commands:
net stop iisadmin /yes net start w3svc
6. Using IIS authentication
In case you want to also use authentication with IIS and tomcat, you have to follow the following steps. On IIS side you have to
In IIS Management Console, on the left panel of the window, navigate to Default Web Site > Jakarta.
- On the right panel of the window, right-click on the isapi_redirect.dll and select Properties.
Select the File Security tab. -> Under 'Anonymous Access and Authentication Control', click the Edit button. -> Check the 'Integrated Windows Authentication' box. -> click OK twice to confirm and close the dialog boxes.
- Close the IIS Management Console.
On tomcat side it is necessary to set the tomcatAuthentication parameter (in $ISAPI_REDIRECTOR_HOME$\conf\server.xml) for the AJP/1.3 connector to false like shown below:
<Connector port="8009" tomcatAuthentication="false" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
7. Additional Information
Some additional information can be found at: Tomcat Doc (comprehensive but a bit complicated) Tomcat with IIS (also helpful, but not really complete).
A good description for integration IIS with Tomcat is given at (although the description refers to Tomcat 5.0.xx): http://support.esri.com/index.cfm?fa=knowledgebase.techArticles.articleShow&d=29051
The file http://downloads.esri.com/support/TechArticles/IMS/tomcat_5028_Windows/Tomcat5028_IIS_IMS91_win.zip that is referenced in this page is very helpful.