There are a few steps which need to be completed in order to get Tomcat to work with IIS6, some of which are required due to the architectural changes and improved security measures in IIS6 – if you are an IIS administrator you will be familiar with these already.
We need to create a virtual directory for the Tomcat connector to use, create a new Web Service Extension in IIS and then enable that web service extension so that it can be used.
One additional step that I am going to take is to create a dedicated application pool for Tomcat to use – you may want to consider doing this if you are going to install Tomcat on a server which hosts other applications. In fact, its good practice to run all your web apps in their own dedicated application pools. A discussion of the relative merits of app pools is outside the scope of this document but if you want to find out more about them then I’d suggest starting here :
#Note – I’ve read a number of documents on this subject which suggest you need to configure IIS6 to run in IIS5 Isolation Mode in order to get it to work properly with Tomcat. I’m not sure why this has been suggested but I don’t agree with it. I have been able to successfully configure the JK2 connector with IIS6 running in its default Worker Process Mode.
You can find out more about IIS6 isolation modes here :
Create the Tomcat Application Pool
Go into IIS Manager and right-click Application Pools. Click New, Application Pool. Select a name for your new application pool and use the default settings to create the new pool. You should now see your new application pool in the list.
Create the Virtual Tomcat Directory
Right-click the Tomcat web site and click New, Virtual Directory. Name the virtual directory jakarta and then browse to D:\Tomcat\bin\win32\i386 and click OK. Click Next and then tick the Execute check-box and then click Finish.
#Note – the Execute permission on the virtual directory is essential for the ISAPI filter to function correctly.
Next, configure the Tomcat Web Site to use its own dedicated application pool. Right-click the Tomcat Web Site, click Home Directory, Properties and then change the application pool it uses from the DefaultAppPool to the new one we just created.
#Note – I have found (through trial and error) that there is either a bug (or a feature) in the JK2 connector which means that its virtual directory cannot exist in a different application pool to its parent web site. I think that this may be why others have suggested that Tomcat doesn’t work with IIS6 in Worker Process mode but that’s not the case, as we shall see…
Update – If you configure the Jakarta virtual directory to run under a different application pool to its parent web site any requests to that directory will fail and you will see an entry similar to the following in the IIS log files :
#Software: Microsoft Internet Information Services 6.0
#Date: 2005-04-28 14:40:51
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status
2005-04-28 14:40:56 127.0.0.1 GET /jakarta/isapi_redirector2.dll – 80 – 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322) 403 18 0
As you can see the status code returned by IIS is 403.18 which, according to KB318380, means “Cannot execute requested URL in the current application pool. This error code is specific to IIS 6.0”
Create and Enable the Tomcat Web Service Extension
In IIS Manager right-click Web Service Extensions and then click Add a new web service extension. Call the new extension Tomcat and then browse to D:\Tomcat\bin\win32\i386\isapi_redirector2.dll and the click OK, click Set extension status to allowed and then click OK.
The Tomcat Web Service Extension is now created and enabled.
Configure the Tomcat ISAPI Filter
Although we have already enabled the Tomcat web service extension we need to configure the JK2 connector as an ISAPI filter at the web site level in IIS. To do this right-click the Tomcat web site and click Properties and then ISAPI Filters tab. Click Add to add a new filter and then enter the name Tomcat and click browse and navigate to the location of the file isapi_redirector2.dll which in our case is D:\Tomcat\bin\win32\i386
Note – If you check on its status, you may notice that the ISAPI filter hasn’t been successfully loaded at this stage, even if you have re-started IIS. This is expected behaviour and is documented in the IIS6 Operations Guide,
“In an effort to optimize resources in IIS 6.0, an ISAPI filter is not loaded until a request is made to a Web site that requires the ISAPI filter. Until this request is made, IIS Manager does not display the status of the ISAPI filter.”
However, once IIS has served a successful request to it you will see the status of the ISAPI filter change to ‘Loaded’.
You should now be ready to test your Tomcat installation by issuing a request to the sample applications, but this time using the default port 80 instead of 8080 as we did above. So fire up a browser and type http://localhost/servlets-examples/ or http://localhost/jsp-examples/ (remember to make the changes to the workers2.properties file described earlier or the requests to these URL’s will fail)
If you check the IIS log files you will see that IIS is indeed processing requests on behalf of Tomcat and you will see entries such as this :
2005-04-28 09:34:14 127.0.0.1 GET /jakarta/isapi_redirector2.dll – 80 – 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322) 200 0 0
And that’s it, you should now have a working installation of Tomcat on IIS 6.0