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!

This entry was posted in J2EE, Systems Administration. Bookmark the permalink.

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

  1. Phil Wilson says:

    FYI, there’s a very nice and full explanation on http://virtualict.net/support/kb/iis6-Tomcat5-JK2.html – it’s for IIS6, but the differences are minimal.

  2. Pingback: Electronic Thumb

  3. Devesh says:

    The url : http://virtualict.net/support/kb/iis6-Tomcat5-JK2.html is a broken link.
    Cna you please also give a sample workers2.properties that can handle multiple uris

  4. Roopa says:

    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

  5. Roopa says:

    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

  6. drummer says:

    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

  7. AJ says:

    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.

  8. noah says:

    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?

  9. Phil Wilson says:

    I promise that when I posted it, that link worked :)

    A PDF rendering of the same page is on http://www.jspwiki.org/attach?page=AttachmentsDemo%2Fiis6-Tomcat5-JK2.pdf (currently. I make no defence in case of linkrot :) .

  10. sathish says:

    hi
    i followed the same steps above mentioned.But it comes
    http403 forbidden

  11. Rick says:

    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.

  12. TJ says:

    http://tjworld.net/help/kb/0001_iis6-Tomcat5-JK2.html

    Here’s a working link to the tutorial i wrote last year – didn’t realise the old virtualict.net domain was no longer in use!

  13. mcnattyp says:

    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.

  14. Pablito says:

    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???

  15. Andre says:

    Can someone explain jk.proporties.
    what is ur:/yoursite section.

  16. Sridhar says:

    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 *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>