10th September 2007

How To Install Apache Tomcat with IIS 6.0

posted in IIS 6.0 |

Configuring IIS

There are a few steps which need to be completed in order to get Tomcat to work with IIS6, some of which are required due to the architectural changes and improved security measures in IIS6 – if you are an IIS administrator you will be familiar with these already.

We need to create a virtual directory for the Tomcat connector to use, create a new Web Service Extension in IIS and then enable that web service extension so that it can be used.

One additional step that I am going to take is to create a dedicated application pool for Tomcat to use – you may want to consider doing this if you are going to install Tomcat on a server which hosts other applications. In fact, its good practice to run all your web apps in their own dedicated application pools. A discussion of the relative merits of app pools is outside the scope of this document but if you want to find out more about them then I’d suggest starting here :

http://www.microsoft.com/resources/documentation/iis/6/all/proddocs/en-us/ca_cfgapppools.mspx

#Note – I’ve read a number of documents on this subject which suggest you need to configure IIS6 to run in IIS5 Isolation Mode in order to get it to work properly with Tomcat. I’m not sure why this has been suggested but I don’t agree with it. I have been able to successfully configure the JK2 connector with IIS6 running in its default Worker Process Mode.

You can find out more about IIS6 isolation modes here :

http://www.microsoft.com/resources/documentation/iis/6/all/proddocs/en-us/ca_aboutsrvrapps.mspx

Create the Tomcat Application Pool

Go into IIS Manager and right-click Application Pools. Click New, Application Pool. Select a name for your new application pool and use the default settings to create the new pool. You should now see your new application pool in the list.

Fig. 20 Create the Tomcat Application Pool

Create the Virtual Tomcat Directory

Right-click the Tomcat web site and click New, Virtual Directory. Name the virtual directory jakarta and then browse to D:\Tomcat\bin\win32\i386 and click OK. Click Next and then tick the Execute check-box and then click Finish.

Fig. 21 Create the Jakarta virtual directory

#Note – the Execute permission on the virtual directory is essential for the ISAPI filter to function correctly.

Next, configure the Tomcat Web Site to use its own dedicated application pool. Right-click the Tomcat Web Site, click Home Directory, Properties and then change the application pool it uses from the DefaultAppPool to the new one we just created.

Fig. 22 Configure the Tomcat Application Pool

#Note – I have found (through trial and error) that there is either a bug (or a feature) in the JK2 connector which means that its virtual directory cannot exist in a different application pool to its parent web site. I think that this may be why others have suggested that Tomcat doesn’t work with IIS6 in Worker Process mode but that’s not the case, as we shall see…

Update – If you configure the Jakarta virtual directory to run under a different application pool to its parent web site any requests to that directory will fail and you will see an entry similar to the following in the IIS log files :

#Software: Microsoft Internet Information Services 6.0

#Version: 1.0

#Date: 2005-04-28 14:40:51

#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status

2005-04-28 14:40:56 127.0.0.1 GET /jakarta/isapi_redirector2.dll – 80 – 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322) 403 18 0

As you can see the status code returned by IIS is 403.18 which, according to KB318380, means “Cannot execute requested URL in the current application pool. This error code is specific to IIS 6.0”

Create and Enable the Tomcat Web Service Extension

In IIS Manager right-click Web Service Extensions and then click Add a new web service extension. Call the new extension Tomcat and then browse to D:\Tomcat\bin\win32\i386\isapi_redirector2.dll and the click OK, click Set extension status to allowed and then click OK.

Fig. 23 Create the Tomcat Web Service Extension

The Tomcat Web Service Extension is now created and enabled.

Fig. 24 The Tomcat Web Service Extension

Configure the Tomcat ISAPI Filter

Although we have already enabled the Tomcat web service extension we need to configure the JK2 connector as an ISAPI filter at the web site level in IIS. To do this right-click the Tomcat web site and click Properties and then ISAPI Filters tab. Click Add to add a new filter and then enter the name Tomcat and click browse and navigate to the location of the file isapi_redirector2.dll which in our case is D:\Tomcat\bin\win32\i386

Fig. 25 Adding the Tomcat ISAPI filter

Note – If you check on its status, you may notice that the ISAPI filter hasn’t been successfully loaded at this stage, even if you have re-started IIS. This is expected behaviour and is documented in the IIS6 Operations Guide,

“In an effort to optimize resources in IIS 6.0, an ISAPI filter is not loaded until a request is made to a Web site that requires the ISAPI filter. Until this request is made, IIS Manager does not display the status of the ISAPI filter.”

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/93f23233-2a47-4104-b0b4-a7ec0d3116f3.mspx

However, once IIS has served a successful request to it you will see the status of the ISAPI filter change to ‘Loaded’.

Fig. 26 The Tomcat ISAPI filter

You should now be ready to test your Tomcat installation by issuing a request to the sample applications, but this time using the default port 80 instead of 8080 as we did above. So fire up a browser and type http://localhost/servlets-examples/ or http://localhost/jsp-examples/ (remember to make the changes to the workers2.properties file described earlier or the requests to these URL’s will fail)

Fig. 27 IIS serving the JSP samples

If you check the IIS log files you will see that IIS is indeed processing requests on behalf of Tomcat and you will see entries such as this :

2005-04-28 09:34:14 127.0.0.1 GET /jakarta/isapi_redirector2.dll – 80 – 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322) 200 0 0

And that’s it, you should now have a working installation of Tomcat on IIS 6.0

Pages: 1 2 3 4

This entry was posted on Monday, September 10th, 2007 at 2:53 pm and is filed under IIS 6.0. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

There are currently 22 responses to “How To Install Apache Tomcat with IIS 6.0”

Why not let us know what you think by adding your own comment! Your opinion is as valid as anyone elses, so come on... let us know what you think.

  1. 1 On October 30th, 2007, Vandana Patnaik said:

    Hi,

    Thanks for the note. Which version of Tomcat are you using and which isapi_redirector.dll?
    Any help will be greatly appreciated?

  2. 2 On October 30th, 2007, Paul Lynch said:

    Vandana,

    I’m pretty sure it was this one :
    http://archive.apache.org/dist/tomcat/tomcat-connectors/jk2/binaries/win32/jakarta-tomcat-connectors-jk2.0.4-win32-IIS.zip

    Paul Lynch

  3. 3 On November 2nd, 2007, Bret minnehan said:

    hello,
    i am setting up apache tomcat on a windows server 2003 system. i am trying to install tomcat because it is needed to run ARC IMS (an internet mapping service). i fallowed your directions but i seem to be getting caught up on the tomcat install. the installer says that it has completed successfully. but then when i go to start tomcat it will not start. i fallowed your directions but i don’t really know whats up.
    thanks again for your direction. they are a great improvement on the documentation that apache has provided.
    any information is great.
    thanks
    -Bret-

  4. 4 On November 13th, 2007, Vandana said:

    You don’t mention using a filter? Did you use one?

  5. 5 On November 20th, 2007, Darren Matthews said:

    Thanks for this, I have followed the instructions but at the moment I’m getting the following error: The HTTP Filter DLL E:\Tomcat\Tomcat 5.5\bin\win32\i386\isapi_redirector2.dll failed to load. The data is the error.

    Not sure what I need to do to resolve this, please can you give me some ideas.

    Cheers

  6. 6 On November 20th, 2007, Paul Lynch said:

    Hi Darren,

    Did you re-boot the machine after the installation ? Also, what are the file permissions on the directory containing the ISAPI DLL ? You could try running Filemon from Sysinternals (now Microsoft) to check for any permissions issues.

    Paul Lynch

  7. 7 On December 3rd, 2007, Chris M said:

    Darren – Check which version of the ISAPI DLL you’re using…

    I was using an old version, and the filter flatly refused to start unless IIS6 is in IIS5 isolation mode.

    Using a more recent version of the DLL and updating the config files enabled me to run it in IIS6 native mode.

    Cheers,

    Chris.

  8. 8 On January 13th, 2008, Shin Guey said:

    Thanks for your great tutorial. I am now have my Apache Tomcat running on my IIS 6.0 now. Really appreciate for your good documentation. However, when I follow your instruction, I have some error encounter which waste some time to figure it out.

    1. The isapi_redirector2.reg doen’t work. I create the file and run merge. It only create the key but not the value. I have to manually put in all the registry inside. Still, thanks for your screencast to make me create the same registry.

    2. At first I dunno which JK2 Tomcat Web Server Connectors file to download. I downloaded the isapi_redirect-1.2.26.dll but it doen’t work( I think this could coz by the registry value doesn’t match). I download the correct one base on the url in the comment. Then it works like charm..:)

    3. When I do fresh installation for the Apache-Tomcat. It doesn’t come with the workers2.properties file. I have to create it myself. Here is the file content to run the example:
    ——————————————
    [channel.socket:localhost:8009]
    info=Ajp13 forwarding over socket
    tomcatId=localhost:8009

    [uri:/jsp-examples/*]

    info=JSP examples, map requests for all JSP pages to Tomcat.

    context=/jsp-examples

    [uri:/servlets-examples/*]

    info=JSP examples, map requests for all JSP pages to Tomcat.

    context=/servlets-examples
    ————————————

    4. As you said, I really cannot run 2 different Application polls on the same root website. But I already have another web site running on port80 and IIS doesn’t allow me to create another website with port 80. So, I just configure the jakarta website to use the same Application poll and it works. However, I haven’t study on how this will effect the performance.

    Anyway, thanks for the great tutorial. This is the best tutorual I found to configure Apache Tomcat on IIS6.

    Do you have any idea how to use the isapi_redirect-1.2.26.dll? This seem to be newer than isapi_redirector2.dll.

  9. 9 On March 17th, 2008, Quan Tran said:

    I don’t find Application Tool and Web service extension on my WindowXP
    I also installed II6 manager on my machine
    Please help me to config it

    Many thanks

  10. 10 On August 21st, 2008, Zacharias said:

    The whole thing doesn’t work when you use Apache Tomcat 6 with IIS 6(with and without isolation), although the js script seems to do the right job and the ISAPI filter seems to work, there are no desired results, by the way you omit urimapper.properties file from the registry. I ve done so many efforts following your tutorial and the tutorial of onjava and wrox book “apache Tomcat 6 Professional” and i end up with nothinng.

  11. 11 On August 24th, 2008, Will said:

    I’ve created a new application pool like you said, the only difference from the standard ISAPI connector intructions. I still cannot get the connector to work unless I put IIS into IIS 5 Isolation mode. This of course kills other apps I have running that require IIS to be running in 6.0 native mode. I did see that under the new app pool you mentioned creating is a place to change the Identity under the identity tab. Could this be where I need to change users to allow different permissions? Any help would be appreciated getting this to work in IIS 6.0 native mode. Using Tomcat 6.0, ISAPI Redirect 1.2.26, IIS 6.0 on Server 2003.

  12. 12 On August 26th, 2008, Paul Lynch said:

    @Will,

    The walkthrough I put together was aimed specifically at the JK2 connector for Tomcat. Unfortunately, development of that connector has been discontinued and is no longer supported by the Tomcat developers. The instructions for connecting using the JK1.2 connector are slightly different so this tutorial won’t necessarily work correctly if you are using the ISAPI Redirect 1.2.26 with IIS.

    However, after reading your comments I built a new VM to see if I could get ISAPI Redirect 1.2.26 to work with IIS 6 in Isolation Mode and I was able to configure it successfully and get the Tomcat sample applications working. I am planning to put together an updated walkthrough which details the steps required to get the JK1.2 connector working with IIS 6.0 which should hopefully be on the site soon.

    Regards,

    Paul Lynch

  13. 13 On November 5th, 2008, links for 2008-11-05 « Rafael Alcalde Cazorla said:

    […] How To Install Apache Tomcat with IIS 6.0 » IIS Admin Blog (tags: programming) […]

  14. 14 On January 27th, 2009, Kalyan said:

    You mentioned a note below:
    #Note – I have found (through trial and error) that there is either a bug (or a feature) in the JK2 connector which means that its virtual directory cannot exist in a different application pool to its parent web site. I think that this may be why others have suggested that Tomcat doesn’t work with IIS6 in Worker Process mode but that’s not the case, as we shall see…

    Update – If you configure the Jakarta virtual directory to run under a different application pool to its parent web site any requests to that directory will fail and you will see an entry similar to the following in the IIS log files :

    #Software: Microsoft Internet Information Services 6.0

    #Version: 1.0

    #Date: 2005-04-28 14:40:51

    #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status

    2005-04-28 14:40:56 127.0.0.1 GET /jakarta/isapi_redirector2.dll – 80 – 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+.NET+CLR+1.1.4322) 403 18 0

    I am getting same problem in the log file
    what should i do when we get this problem
    Please provide the solution

  15. 15 On January 30th, 2009, Ryan said:

    If you are inserting the registry changes, be sure to stop the tomcat service….it just works if the service is stopped…does not if the service is running!

  16. 16 On February 26th, 2009, Hector said:

    Thks for the tutorial, but i have a problem because when restart the server the IIS and Apache Tomcat dosent work anymore.

    HTTP Error 403 – Forbidden
    Internet Explorer

  17. 17 On March 8th, 2009, Guru, Support Desk- Modulesoft said:

    Hello,
    we have our own dedicated server running Windows 2003 Web Edition withh SP2, IIS
    .net 3.5 and PHP.

    We want to offer JSP Hosting in our server. so what r the softwared i need to install and how to configure so that the existing site will not chaneg and jsp also work .

    please , I ma very concern because we have hosted more then 2000 sites so if anything goes wrong i will be lost.

    kindly consider this . and let me knwo whth proper downlaod version and link and instruction.

  18. 18 On July 12th, 2009, Jason said:

    Hello,

    I would just like to say thank you VERY MUCH for your tutorial. More importantly, your tutorial was the only one that made a reference to Isolation Mode, which is what got my configuration working!

    Thanks again!

  19. 19 On July 21st, 2009, kaizentech said:

    Great instruction. Definitely this will help many technical persons having problem in that field like me.

  20. 20 On February 18th, 2010, Craig said:

    This is a great tutorial, just one thing missing.. SSL and how to make it work between the two apps.

  21. 21 On April 12th, 2010, Cordth said:

    I’ve got everything working great with your instructions. We have two outstanding issues and I need your assistance. We have a code signing cert for the jar files (back on a Linux box) that appears to work well. We have a SSL cert that is properly installed on the IIS…

    Here is the problem,
    non-SSL — everything works great
    SSL — it is not working?

    Do I need to change the ports on the server.xml? Do I need to make changes with other files? I’m not wanting a re-direct, but for all traffic to go via SSL.

    In closing, our application needs to have authentication prior to being launched and we are wanting the SSL cert on the IIS front-end box. After the authentication, all traffic needs to then be SSL secured. I’m 99% confident that putting the SSL cert on the IIS box up front is the way to go, but to then get HTTPS traffic to work has been… puzzeling.

    Thanks for your help/suggestions.

    Cordt

  22. 22 On September 14th, 2010, vinod said:

    Hi,
    I have issue with Tomcat installation i have downloaded latest version 7 and it was the same issue with 5/6 versions also, I am on a Domain to my user i have Administrative permissions, on my mechine it installed properly but when i moved to new meachine with same user with Administrative permission I unable to install tomcat it stops at exe and prompt with alert message
    “Failed to install tomcat 5 service
    Check your settings and permissions
    Ignore is not recommended ”
    Abort Retry Ignore
    Any solutions i googled lot not worked it’s a fresh machine java 6 version variables are aloted.
    zip version works well.
    please provide solution

Leave a Reply

You must be logged in to post a comment.

  • Calendar

  • December 2016
    M T W T F S S
    « Sep    
     1234
    567891011
    12131415161718
    19202122232425
    262728293031