Getting IIS 5.x & Tomcat 5.x to play nice

Just for posterity’s sake, directions on how to get IIS 5.1 (ie: Windows XP Professional) and Tomcat 5 to play nicely. The directions assume that you have Tomcat 5.x and IIS 5.x installed and functioning.

a) Download Tomcat Web Server Connector JK 2 (download)

b) extract the isapi_redirector2.dll to the bin directory of your Tomcat installation.

c) add a Virtual Directory in IIS called ‘jakarta’. Point the Local Path to the bin directory of your Tomcat installation (on my system this is: C:\Program Files\Apache Software Foundation\Tomcat 5.0.25\bin\). Give the Virtual Directory Scripts & Executables execute permissions.

d) Create 2 text files in the /conf/ directory of your Tomcat installation called workers2.properties and jk2.properties. Here is a sample workers2.properties:

[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009
[uri:/samples/*]
info=Map the /samples director

You’ll need to add anything you want mapped from IIS to Tomcat to the [uri:/yoursite] section. Here is a sample jk2 properties file:

# The default port is 8009 but you can use another one
# channelSocket.port=8019

e) Edit your registry: 1) Create a key: HKLM\\SOFTWARE\\Apache Software Foundation\\Jakarta Isapi Redirector\\2.0. 2) Add string values for (no apostrophes) ‘extensionUri’, ‘serverRoot’, ‘workersFile’, ‘authComplete’, and ‘threadPool’. 3) Update the string values for extensionUri to be ‘/jakarta/isapi_redirector2.dll’, serverRoot to be the root of your Tomcat installation (on my system this is ‘C:\Program Files\Apache Software Foundation\Tomcat 5.0.25′), threadPool to be ’20’, and workersFile to be the location of your Tomcat installation + ‘conf\workers2.properties’ (which on my system turns out to be this: ‘C:\Program Files\Apache Software Foundation\Tomcat 5.0.25\conf\workers2.properties’.

f) Restart IIS and Tomcat and you should be golden!

16 thoughts on “Getting IIS 5.x & Tomcat 5.x to play nice”

  1. Pingback: Electronic Thumb
  2. Hi,

    I followed all the steps but when I run the jakarta site i.e.,
    http://localhost/jakarta it gives an error HTTP 403(Forbidden)

    One more step I have done in addition to the above mentioned steps is, I have changed the port from 8080 to 80 in the server.xml file.

    Kindly help me how to resolve this and get the website running

    Thanks,
    Roopa

  3. Hi,

    I followed all the steps but when I run the jakarta site i.e.,
    http://localhost/jakarta it gives an error HTTP 403(Forbidden)

    One more step I have done in addition to the above mentioned steps is, I have changed the port from 8080 to 80 in the server.xml file.

    Kindly help me how to resolve this and get the website running

    Thanks,
    Roopa

  4. Guys, good tutorial, I think its working…but
    the uri & Map path example, I dont quite understand.

    My Tomcat install contains no ‘samples’ directory as such, which other folder an I point this to so I can test the install – getting blank pages at localhost:8009.

    Anyone help?

    [uri:/samples/*]
    info=Map the /samples director

  5. hi Drummer,

    The ‘samples’ URI is just that… a sample. You create your own URI (ie: /drummer/) and then point that at something that exists in Tomcat.

  6. I cannot get this to work either… but I am trying to attach the ISAPI to a secondary IIS web site that responds to a specific header, i.e. “www.server.com:80” is an IIS ASP site and “tomcat.server.com:80” should forward requests into Tomcat running on 8080.

    I also want to map the ROOT webapp to the IIS virtual host root — it sounds like workers2.properties would have “[uri:/*]” defined in it but I don’t know if that’s how the filter/JK2 can work… does a webapp have to be explicity defined, and if it does, how can I map it to “/” from IIS?

  7. Looks like an important step was left out. To get this to work you need to add the ISAPI Filter to your IIS. To do this, open IIS Manager, right click on the server and select properties. Next to WWW Service, click Edit button then select ISAPI Filters tab. Now click add, enter a name (“Jakarta Redirector 2” will work) and the browse to the isapi_redirector2.dll file. Apply the settings and restart the IIS server.

  8. Much thanks, TJ.

    You may want to re-mention the importance of the workers2.properties modifications for URL matching. 5.5.9 keeps the examples in a different URL pattern than the workers file defaults, making modification of that file required before even viewing the examples.

  9. I’ve done everything, but doesn’t works yet!
    I’m with IIS 5.1 and Tomcat 5.0.28…
    Done all the things you wrote, but when I ask for
    http://localhost/jakarta/ I get
    Directory Listing Denied
    and if I put on exploration directory permits I get all the files on the bin directory of Tomcat!!!
    Why???

  10. Not sure this will work. Can anybody please leave some information, how we can invoke java application from asp application?

Leave a Reply

Your email address will not be published. Required fields are marked *