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

Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

Chris Hulbert

(Comp Sci, Hons - UTS)

Software Developer (Freelancer / Contractor) in Australia.

I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!

Get in touch:
[email protected]
github.com/chrishulbert
linkedin



 Subscribe via RSS