Sharing the Point

Office 365, SharePoint, Project Server – Support Blog

How to Configure IIS 7 and Tomcat Redirection on Windows Server 2008 (64 Bit)

Posted by Ashraf on September 20, 2010

Objective: To provide a Secure Server Environment and Running non IIS compatible extensions like jsp in IIS Web server.

Check Before you Start:

JDK 1.6
IIS 7.5
Tomcat 6.0.18
Isapi_redirect.dll (64bit) version 1.2.28

Steps to follow:

Install Jdk 6

Download and install JDK 6 with its default setup options.
Now, go to Computer>Properties>Advanced System Settings>Advanced Tab>Environment Variables

Set System Variables (JAVA_HOME and CATALINA_HOME)

Click New, enter name as JAVA_HOME and your jdk installation path as variable value; click OK.

set java_home variable

set java_home variable

Select PATH and click Edit. Add the java installation path after the current value with a semicolon (;). Click OK, when done.

set java path

set java path

Click New, enter name as CATALINA_HOME and your Tomcat installation path as variable value; click OK.

set catalina_home

set catalina_home

Install Tomcat 6.0.18

Install Tomcat with default settings and test running the URL as http://localhost:8080

tomcat running on port 8080

tomcat running on port 8080

Tomcat setup is working on port 8080.

Setting up Registry value

1. Download the isapi_redirect.dll from the Tomcat site for Windows Server 2008 R2 64 bit from the following URL.
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win64/jk-1.2.28/amd64/

2. Rename the isapi_redirect-1.2.28.dll to isapi_redirect.dll
3. Copy the isapi_redirect.dll to C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\bin\
4. Run Regedit as Administrator
Find the key [HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\
Make one new key entry as “Jakarta Isapi Redirector” then another new key entry name “1.0” then under that make 6 new string values.

setup registray value for Isapi_Redirect dll

setup registray value for Isapi_Redirect dll

NOTE: If “Apache Software Foundation” folder does not exist in the hierarchy mention here then create the path manually. So, the hierarchy will resemble the following.
[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0]

Registry Key  and  Value

@=

extension_uri = /jakarta/isapi_redirect.dll

log_file = C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\logs\isapi_redirect.log

log_level = error

worker_file = C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\conf\workers.properties.minimal

worker_mount_file = C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\conf\uriworkermap.properties

Install and Configure IIS Role

1. Add iis role

Add IIS Features

Add IIS Features

Add IIS Features

Add IIS Features

Click Next and Finish the installation.
You can check wheter the iis works or not by addressing your browser to http://localhost.

iis7 running at localhost

iis7 running at localhost

Now the IIS works fine, we will go to the next steps.

2. Setup isapi & cgi restriction at iis server

A. Open IIS Manager and Select Your Server
B. From the features view open ISAPI and CGI Restrictions, Click Add from the Actions bar

Setup isapi & cgi restriction

Setup isapi & cgi restriction

C. For ISAPI or CGI Path click the … Button and choose your isapi_redirect.dll file at your tomcat installation folder (C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\bin\).

Setup isapi & cgi restriction

Setup isapi & cgi restriction

D. In the Description Field write “isapi_redirect”
E. Tick the Allow extension path to execute and click OK.

3. Enable isapi filters at iis default website

F. Select Default Website and double click ISAPI Filters to open it. Click Add

Enable isapi filters at iis default website

Enable isapi filters at iis default website

G. Enter “jakarta” in the filter name And click …Button to to select the isapi_redirect.dll.

H. Click open to select the dll and Ok to close the window when done.

4. Creating Virtual directory and handler mappings

I. Right click to the Default website and choose Add Virtual Directory…

J. Enter “jakarta” in the Alias field and choose the path of the “isapi_redirect.dll” file (C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\bin\) as Physical path.

set virtual directory path

set virtual directory path

K. Click ok when done.
L. Now, Open Handler mappings by selecting the virtual directory “Jakarta”.

jakarta handler mapping

jakarta handler mapping

M. Select Edit Feature Permission from the Actions bar and Check All (Read, Script, and Execute) and click OK.

Creating properties file

Now create two properties FILE AS follows:
1. Create a file named “workers.properties.minimal” in the “conf” folder which you can find in the tomcat installation folder.
2. Insert the following lines into this file:

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

3. Create another file named “uriworkermap.properties” in the same directory. Insert this line and save.

/*=worker1

Test and Run

4. Restart the Tomcat Service and the IIS Web-Server

5. Test the configuration by trying to access the iis site(http://localhost), if you get Tomcat site then you are done successfully.

tomcat running at iis

tomcat running at iis

Hope this helps.

About these ads

56 Responses to “How to Configure IIS 7 and Tomcat Redirection on Windows Server 2008 (64 Bit)”

  1. Rajesh said

    Really gr8 and very very useful helpful article, thank a lot..

  2. Ashish Raichura said

    Really great, screens helps lot. Question: What if my tomcat is not on 8080 and on different port say 11500. I tried but not working can you able to help me ?

  3. Ashraf said

    Hi Ashish,
    I think you can first try with the default port and then try to change the port. Most probably you have to do something on the worker file specially at localhost, not 100% sure because i never try this. Thanks

  4. Scott Tansley said

    Hi,

    Spent two days trying to get SSL to work on Tomcat. Eventually gave up and did it on IIS, and then needed to connect Tomcat to that. You’re instructions have helped me massively, as a first timer. They were communicated really well.

    Thanks so much for taking the time to write this!

    Regards,

    Scott

  5. Marcos Mariano said

    Hey, very cool tutorial man. But, i still have a problem, i cant run jsp files on my server. html works fine, but when i go to jsp pages, i got error 404.
    Can u help?

    • Ashraf said

      Hello Marcos,
      Thanks for your comment. The 404 resembles the page is not found. can you access the jsp pages directly from tomcat? if it goes ok then please try with work file and allow everything to be browsable through iis.
      Hope this helps. Please feel free to contact. thanks again.

  6. Jonathan said

    Thank you for this, this was extremely useful.

  7. asif said

    Hi, This is helpfull tutor. but when i configure tomcat, IIS not working no asp and aspx is working. I made vartual folder for asp and aspx page. its is redirecting tomcat. pleas tell how same website tomcat and iis will work for jsp and asp page.

    thanks

    • Ashraf said

      Hi Asif,
      if you configure this way ever request on iis will forward to tomcat. you need to setup in the worker for which it iis will forward to tomcat. hope this helps.

      • asif said

        Thanks for prompt reply, Can tell me steps to setup throug worker. I want same website one vartual directory for jsp and another vartual disrectory for aspx . Please tell me the process.
        Thanks

      • Ashraf said

        Hello Asif,
        Please follow this linkhttp://tomcat.apache.org/connectors-doc-archive/jk2/jk/iishowto.html and read Advanced Worker Configuration carefully. As you have application in iis you have to forward specific folder/file request to the tomcat(host) rather then redirect everything. you have to use something like the following for worker,

        you can use these workers to serve two different contexts/applications each with its own worker :
        /examples/*=worker1, this will reply the tomcat examples applications
        /webpages/*=worker2 , this will reply the webpages

        so configure as per your need. this is just for your idea.thanks

      • Ashraf said

        Asif,

        /*=worker1 will redirect everything to tomcat. Suppose you want to redirect to specific application request to tomcat then i think you can use something like follows,

        /your application/*=worker1

        Let me know your status.

  8. asif said

    I am still strugling to setup. thanks ashraf.i will try again.

  9. asif said

    Thank You very much. I have solved the problem. Thank You

  10. windows said

    shareware…

    How to Configure IIS 7 and Tomcat Redirection on Windows Server 2008 (64 Bit) « Ashraf's Share Point…

  11. bhagyashree said

    After following all steps.. i am getting

    HTTP Error 500.0 – Internal Server Error
    Calling LoadLibraryEx on ISAPI filter “C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\isapi_redirect.dll” failed

    • Rama Arun said

      In IIS Manager – 1. Double Click “Application Pools” 2. Select DefaultAppPool (your website) 3. Select “Advanced Settings” from Actions 4. Set “Enable 32-bit application” to TRUE. Restart.. it will work.

  12. bhagyashree said

    After following all steps.. i am getting

    HTTP Error 500.0 – Internal Server Error
    Calling LoadLibraryEx on ISAPI filter “C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\isapi_redirect.dll” failed
    so let me know.. where i am wrong

    • Ashraf said

      I would like to recommend you to check all the settings as per your environment. Before redirecting make sure IIS and tomcat works fine. thanks

  13. Bharath said

    This worked thanks..

    I have my webapp in e:\test

    I created a new site in IIS with path to e:\test and i congifured jakarta i get the first page (login page) and after i click the button i get ” HTTP Status 404 /web/validate.jsp ”

    description The requested resource (/PramWeb/ValidateLogin.jsp) is not available.

  14. [...] Kalau mau tau konfigurasi IIS dengan Tomcat, bisa refer ke sini [...]

  15. alexis said

    Hi

    I tried to follow your step by step tutorial for configuring jsp in IIS but unfortunately I’m stuck because i can’t find any isapi_redirect.dll

    can anyone please send me a link…

    Thanks

    Alexis

    • Ashraf said

      do you download it from the mentioned URL?

      • alexis said

        Hello Ashraf

        Thanks for the reply, the URL you’ve mentioned is broken.

        It say’s

        Not Found

        The requested URL /dist/tomcat/tomcat-connectors/jk/binaries/win64/jk-1.2.28/amd64/ was not found on this server.

        Apache/2.3.15-dev (Unix) mod_ssl/2.3.15-dev OpenSSL/1.0.0c Server at http://www.apache.org Port 80

      • Ashraf said

        Actually i didn’t try this URL recently but this was working when i did this stuffs. You can search internet and can email them for the latest.thanks

  16. Mauno said

    This was great. In older versions, the regedit was not necessary, and so I tried without editing registry.
    So I have a new problem: IIS 7.5 returns just the bytes in isapi_redirect.dll (and browsers ask what to do with it – open or save).
    Then did the regedt, but with no luck.

    • Armando said

      I’ve the same problem!!!

      Did you managed to fix it??? I have followed all the steps, several times and have tried with diferent Tomcat servers and when IIS redirect it returns only a binay file…

      I’m using Windows 2008 R2 Server (64bits) with IIS7.5 and redirecting to Tomcat 6 (Alfresco in it) and Tomcat 7… but it doesn’t work.

      Using DLL version 1.2.36 for 64 bits, downloaded from “http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/”

  17. miguel said

    Very good! thanks

  18. miguel said

    Hello,
    I had some trouble to make it work until I saw:

    If you must use a 32 bit IIS connector, you can do so by clicking Application Pools > Advanced Settings > Allow 32bit applications

    (from http://confluence.atlassian.com/display/JIRA/Integrating+JIRA+with+IIS)

    And it started to work
    Hope this help anyone with this problem.

  19. Denis Tse said

    Awesome step-bystep.

    It worked in the first time!

    A little but usefull comment:

    to redirect a specific realm, alter the uriworkermap.properties with the desired realm to be redirect:

    /examples/servlets/*=worker1
    /examples/jsp/*=worker1

  20. Dinesh said

    Hi,
    I have installed, but when i use local host its working fine, but when i access the same url using the server name instead of local host its failing to connect, getting Connection Time out error.

    Can you please help me in this,

  21. Atul said

    Thanks for this info. Very Helpful

  22. ashok said

    its realy good its save my time and my blood

  23. Senthil said

    Hi Ashraf,
    Its a very useful article. I want to do the same configuration for IIS7.5(WWin2008) with Tomcat5.5 which one came inbuild with Business objects software.
    Is there any special settings required for that?

    Thanks,
    Senthil.

    • Ashraf said

      Hi Senthil,
      Thanks for your comment.I never try business objects but if the iis and tomcat is fine then i guess the same steps will help you.

  24. Ram said

    Hi,

    Tomcat 6 integrating with IIS 7

    I am trying to front end IIS7 for Liferay (Tomcat) and Alfresco (Tomcat) using isapi_redirect-1.2.28.dll. Both running in each one Tomcat 6 servers. Liferay runs ROOT context so all the request URI / and /* to be mapped to tomcat1 (liferay) except URI /alfresco and /alfresco/*. I have tried the following URI mappings. Please help on this URI mapping.

    Option – 1 : Liferay (tomcat1 mapping) working fine, But Alfresco (tomcat2 mapping) not working.
    /=tomcat1
    /*=tomcat1
    /alfresco=tomcat2
    /alfresco/*=tomcat2

    Option – 2 : Liferay (tomcat1 mapping) working fine, But Alfresco (tomcat2 mapping) not working.
    /=tomcat1
    /*=tomcat1
    /alfresco=tomcat2
    /alfresco/*=tomcat2
    !/alfresco=tomcat1
    !/alfresco/*=tomcat1

    Option – 3 : Alfresco (tomcat2 mapping) working fine, But Liferay (tomcat1 mapping) not working.
    /alfresco=tomcat2
    /alfresco/*=tomcat2
    !/alfresco=tomcat1
    !/alfresco/*=tomcat1

    Please help to fix the mapping.

    thanks,
    Ram

  25. Felix said

    Thanks for this great Tutorial…
    Still there is one thing I wasn’t able to manage:
    I want to use subdomains to address different applications and websites on my server:

    app1.mysite.com –> using worker 1
    app2.mysite.com –> using worker 2
    app3.mysite.com –> using worker 3

    using your hints I’m only able to point to Tomcats landing page – not to the application

    localhost:8080/app1
    localhost:8080/app2
    localhost:8080/app3
    .
    With the rewrite option it is possible to “extend” the requested URL and point it to the application.

    Do you have any Ideas how I can configure the workers that they will point to an application like it is described above?

    Thanks again..
    Felix

  26. Brian said

    I followed these steps for Windows 2008 (64 bit), IIS 7.5, Tomcat 7.0.29, isapi 1.2.37. I am unable to get this to work. Has anyone successfully don this with these versions?

    • Rama Arun said

      A better and simpler way is to use BonCode Connector. Download package from here tomcatiis.riaforge.org/ and go through this video. You will integrate Tomcat and IIS in minutes. isapi is a pain.

  27. [...] How to Configure IIS 7 and Tomcat Redirection on Windows Server …Sep 20, 2010 … How to configure SSL(https) on IIS 7 with Self-signed Certificate » …. But, i still have a problem, i cant run jsp files on my server. html works fine, … [...]

  28. Avisek said

    Hi All,

    I am unable to download ISAPI_redirect.dll file from Tomcat site on connector section.When i download the zip file from Tomcat site i only see mod_jk.so file and some other readme/license file.I am trying to download the required file on my desktop and from my desktop copied to server and install it over there.

    Please advice how to install isapi_redirect.dll file.

    Thanks in Advace.

    ER

  29. Troy said

    What would cause the browser to try and download the isapi_redirect.dll file instead of actually being redirected to the servlet? I can see in the isapi_redirect.log file that the dll is loaded and that it recognizes the path and that it’s supposed to redirect it to the servlet, but instead of being redirected, the browser prompts the user to save the file as the name of the servlet.

  30. I would like to thank you for posting this. I was following the instructions at tomcat.apache.org, and they were missing some critical steps for IIS 7.5. This walkthrough solved the problems.

  31. Mohammed said

    Hi Ashraf,
    I have followed the instructions step-by-step, but in the end I had an error when I tested it; HTTP Error 404.4 – Not Found – “The resource you are looking for does not have a handler associated with it.”. Please I really need your help. Thanks

  32. Very good info. Lucky me I found your blog by chance (stumbleupon).

    I have saved as a favorite for later!

  33. Abhishek Triapthi said

    I got the following error. Can someone help me in rectifying this?

    Service Temporary Unavailable!

    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

    Jakarta/ISAPI/isapi_redirector/1.2.37

    • Ram said

      Please ensure Tomcat running and see log C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\logs\isapi_redirect.log

  34. ghoshdd said

    Guys – Need help..In the above set up, it is mentioned that to make sure the following folders C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0 must exist while adding in regedit.

    My problem is that my tomcat is installed in a different directoty “C:\Program Files (x86)\SAP BusinessObjects\Tomcat6″. So there is no folder called “Apache Software Foundation”. How to handle it? Do I need to really keep “Apache Software Foundation” folder?
    Please help

    • Ram said

      Replace “C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0″ with your tomcat path “C:\Program Files (x86)\SAP BusinessObjects\Tomcat6″

  35. Roopa said

    I followed all th esteps as mentioned…but when accessing http://localhost/ I get the error message “HTTP Error 404.4 – Not Found
    The resource you are looking for does not have a handler associated with it.” .. Anyone has any idea?

  36. Dennis Geasan said

    Word of caution – it’s probably already been noted but just in case. The entry for the ‘uriworkermap.properties’ as provided in the tutorial will direct all IIS URL’s to tomcat. In that file you have to put the specific tomcat web apps you want IIS to direct a URL to. For example, if you have a Tomcat web app named ‘gloriousApp’ then in ‘uriworkermap.properties’ the entry is:

    /gloriousApp=worker1
    /gloriousApp/*=worker1

    The URL to IIS entered into a browser would be http://myWebServer/gloriousApp.

    You do this for each Tomcat web app. /*=worker1 would not be in ‘uriworkermap.properties’ unless you did want all IIS calls to go to Tomcat.

  37. When I initially commented I clicked the “Notify me when new comments are added” checkbox
    and now each time a comment is added I get several emails
    with the same comment. Is there any way you can remove me from that
    service? Cheers!

Sorry, the comment form is closed at this time.

 
Follow

Get every new post delivered to your Inbox.

Join 62 other followers

%d bloggers like this: