• Home
  • About
Blue Orange Green Pink Purple

Getting IIS and Tomcat to play nicely with isapi_redirect

Posted in code. on Monday, August 24th, 2009 by Chris Hulbert
Aug 24

If you've got a Java application hosted within Tomcat, and you want to plug it into an existing IIS site, here's how. Oh and before we start, this is for IIS 6, and Tomcat 6.

Firstly, make sure your Tomcat install is setup to listen for AJP connections. By default it should be configured, but it can't hurt to check. Look in the Tomcat\conf\server.xml for something like this, if its missing then uncomment/add it and restart Tomcat:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Then download the latest isapi_redirect*.dll from here:
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/
I grabbed isapi_redirect-1.2.28.dll. Rename it to 'isapi_redirect.dll' (eg remove the version number) and put it in c:\isapi_redirect.

Make a 'isapi_redirect.properties' file in that folder, with the following contents:

extension_uri=/isapi_redirect/isapi_redirect.dll
log_file=c:\isapi_redirect\isapi_redirect.log
log_level=error
worker_file=c:\isapi_redirect\workers.properties
worker_mount_file=c:\isapi_redirect\uriworkermap.properties

Make 'uriworkermap.properties' in that folder, with the following contents:

/myapp/*=myworker

Make 'workers.properties' in that folder, with the following contents:

worker.list=myworker
worker.myworker.type=ajp13
worker.myworker.host=localhost
worker.myworker.port=8009

Go into the IIS Manager (in Administrative tools). Expand the local computer and 'Web Sites'. Right click on 'default website' (or whichever) and choose properties. Under the ISAPI filters tab, add the executable 'c:\isapi_redirect\isapi_redirect.dll', with the name 'isapi_redirect'.

Right click the 'default website' (or whichever) again and do New->Virtual Directory. Make the alias 'myapp' (whatever you used currently to access your application in tomcat directly eg http://localhost:8080/myapp). For the path, use any empty folder. For permissions, only choose 'read'.

Right click the 'default website' (or whichever) again and do New->Virtual Directory. Make the alias 'isapi_redirect'. For the path, use 'c:\isapi_redirect'. For permissions, choose 'read' and 'execute'.

Right click 'Web Service Extensions' -> 'Add a new …'. For the name, choose 'isapi_redirect'. For the required files, click 'add' and select 'c:\isapi_redirect\isapi_redirect.dll'. Click on the checkbox 'Set extension status to Allowed'.

Once all this is done, restart IIS (do a start->run->iisreset), and navigate to http://localhost/myapp and it should all work (hopefully). Email me if it doesn't, i'm happy to help.

Great thanks go to atlassian for creating a good (Jira-specific) writeup which i referred to, it's much better than the apache docs for isapi redirect! Here it is:
http://www.atlassian.com/software/jira/docs/v3.13/iisintegration.html

Leave a Reply

Chris' Babble

  • About
    Hi, i'm Chris Hulbert, a software guy from Sydney Australia.
  • Categories
    • code
    • Portfolio
    • Uncategorized
  • Recent Articles
    • How to implement DES and Triple DES from scratch
    • How to use Cookies in Struts 2 with ServletRequest and ServletResponse
    • How to use sessions with Struts 2
    • Using Quartz Scheduler in a Java web app (servlet)
    • Javascript date picker that Doesn't Suck!(tm)
    • Using Oracle XE with Hibernate


  • Home
  • About

© Copyright Chris' Babble. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top