Debugging : How To Configure IIS 7.0 and Tomcat on Windows Server 2008

Question/Problem : How To Configure IIS 7.0 and Tomcat on Windows Server 2008
I have a Website designed in ASP.NET 3.0 and have another application in Java and after i read your some of the bogs came to know about the dependencies of java and dotnet so decided to combine both of the application in a single one web application. Actually Website in ASP.net is a Bio Portal and the application in java is a webmail Portal. since both are right at there places but the problem is that java based webmail needs Apache tomcat for execution as a must and have installed Bio Portal on a domain hosted on IIS 7.0 (Windows server 2008). is unable to interrelate both the technologies into one. could any one can help me.

Solution : For the purposes of this installation guide I used Java Runtime Version 6 Update 21, Apache Tomcat 6.0.29 and the Microsoft IIS Application Request Routing (ARR) 2.0 module.

You can download the software that I used in this guide from the following locations :

1. Java JRE Version 6 Update 21 (If have installed this go to point 2)
http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Apache Tomcat (32-bit/64-bit Windows Service Installer) (If have installed this go to point 3)
http://tomcat.apache.org/download-60.cgi

3. IIS Application Request Routing (ARR) 2.0 (If have installed Proceed from here to next)
http://www.iis.net/download/applicationrequestrouting

Start by installing the Java runtime (JRE) and accept the license agreement.

Then change the installation target folder to C:\Java and then click OK and wait while Java installs

Once you have installed Java you can start installing Tomcat. Double-click the apache-tomcat-6.0.29.exe file to invoke the Apache Tomcat Setup Wizard.

Choose a Custom installation and ensure that the Examples are selected as shown here. You wouldn’t necessarily want to install the sample applications in a production environment but we will be using them in this walkthrough so we need to install them.

Select to install Tomcat in the C:\Tomcat folder as shown here and then click Next.

Leave the default HTTP/1.1 Connector port set to 8080 and choose a password for the admin account.

The setup wizard should find your Java installation automatically.

Click install and wait while Tomcat setup completes. When the installation is complete click Finish.

Now that you have Tomcat up and running you can test your installation by pointing your server’s browser at http://localhost:8080 and you should see the default Apache Tomcat welcome page as shown here.

Now that we have got Tomcat working

Now the configuration of IIS 7.0 and Tomcat can be done with two ways

  1. using IIS ARR Module
  2. Using JK 1.2 ConnectorWe will be proceding for the solution step by step, so let us start our first step using IIS ARR Module.

1. How To Configure IIS 7.0 and Tomcat with the IIS ARR Module

we need to install and configure the IIS Application Request Routing module which will allow IIS to act as a proxy server and forward requests on to Tomcat. Run the ARRv2_setup_x86_en-us.EXE file (or ARRv2_setup_amd64_en-us.EXE if you are using 64-bit Windows) to begin the ARR setup routine.

When the ARR module installation has completed it will create a log file (arr_setup.log) which can be found the %TEMP% folder.

Now that the Application Request Routing (ARR) module has been installed we need to configure it to act as a proxy server (this functionality isn’t enabled by default). In IIS Manager highlight the Application Request Routing Cache feature and click Open Feature in the Actions pane.

Click Server Proxy Settings in the Actions pane.

Tick the Enable proxy checkbox and then click Apply. Leave all the default values in place.

Next we need to configure a URL Rewrite rule so that IIS knows what to do with requests which we want to forward to Tomcat. Click the Default Web Site, highlight the URL Rewrite icon and then click Open Feature in the Actions pane.

In the URL Rewrite feature click Add Rules in the Actions Pane.

In the Add Rule(s) dialog box select Blank rule and click OK.

In the Edit Inbound Rule feature assign a name to the new rule and type (examples.+) in the Pattern dialog box. The new rule should default to using Regular Expressions (if it doesn’t ensure that you select this option)

In the Action section of the Edit Inbound Rule feature ensure that the Action type is set to Rewrite and then enter http://localhost:8080/{R:0} in the Rewrite URL dialog box as shown below. Click Apply to create the new rule.

Everything we need to configure is now in place and we are ready to test. Start by browsing the ‘Request Headers’ sample application from Tomcat directly on port 8080 with the result shown here.

The final step is to browse the same ‘Request Headers’ sample application on port 80 so that the request will be handled by IIS before being forwarded to Tomcat by the ARR proxy. If everything is configured correctly you should see the sample application load successfully as shown here.

If you now examine the IIS log file (which can be found in C:\inetpub\logs\LogFiles by default) you will see that the request for the Tomcat sample application was processed by IIS and proxied by the ARR module. The IIS log file contains both the X-ARR-CACHE-HIT and X-ARR-LOG-ID details as shown here.

Using the IIS ARR module means that there is no longer any need to use the Tomcat JK 1.2 ISAPI Connector. However, I would always recommend that you test your application rigorously before deploying it in a production environment. If you do find any issues with ARR you can always get support in the IIS ARR forums here :

http://forums.iis.net/1154.aspx

2. How To Configure IIS 7.0 and Tomcat with JK 1.2 Connector

Now we need to configure the JK 1.2 Connector which will allow IIS to effectively act as a proxy and forward requests on to Tomcat. Start by creating a folder called ‘ISAPI’ under the Tomcat root folder. Then copy the isapi_redirect-1.2.28.dll file into the ‘ISAPI’ folder and rename the file to isapi_redirect.dll as shown here.

In order to configure the Tomcat connector you need to either add an entry in the Windows registry or you can use the isapi_redirect.properties file. The isapi_redirect.properties file tells the connector where to find its configuration files and also where the isapi_redirect DLL file is located. If you have used the same directory structure as I have you can configure your isapi_redirect.properties file as shown here.

We also need to either update or create the two Tomcat connector configuration files (workers.properties and uriworkermap.properties) so that the connector knows how to handle the requests it receives. These configuration files are documented on the Tomcat web site here : The Apache Tomcat Connector – Reference Guide
If you have just installed Tomcat with the sample applications then you can copy the sample uriworkermap.properties file shown here. Both config files need to placed in the Tomcat ‘conf’ folder which in this example is C:\Tomcat\conf

You can also copy the sample workers.properties file as shown below and save it to the C:\Tomcat\conf folder.

Now we need to configure IIS. Start by creating a virtual directory and give it an alias of ‘jakarta’ as shown here. Incidentally, you don’t have to call the virtual directory ‘jakarta’ – you can actually give it any name you like, just so long as the name you choose appears in the extension_uri line of your isapi_redirect.properties file.

Next we need to configure the virtual directory to have execute permission. This was a simple tick-box option in IIS 6.0 but in IIS 7.0 we need to click on the Jakarta virtual directory and then double-click Handler Mappings.

Within the Handler Mappings feature click Edit Feature Permissions in the Actions Pane.

Click Execute in the Edit Feature Permissions dialog box and click OK.

In the Handler Mappings feature you can now see that calls to ISAPI-dll files are enabled.

The next step is to add an ISAPI filter on the web site. To do this click on the web site and then double-click the ISAPI Filters feature.

In the Actions pane click Add.

In the Add ISAPI Filter dialog box enter a name and the path to the isapi_redirect.dll file and click OK.

The Tomcat ISAPI filter should now appear in the ISAPI Filters list as shown here.

The final step we need to take is to configure the ISAPI and CGI Restrictions feature in IIS 7.0. This is analogous to adding or allowing a Web Service Extension in IIS 6.0. In IIS Manager navigate to the Server Home and then double-click on the ISAPI and CGI Restrictions feature.

In the ISAPI and CGI Restrictions feature click Add on the Actions pane.

In the Add ISAPI or CGI Restriction dialog box enter a name and the path to the isapi_redirect.dll file, tick the Allow extension path to execute option and click OK.

The Tomcat ISAPI extension should now appear in the list with a Restriction status of allowed as shown here.

Everything we need to configure is now in place and we are ready to test. I started by requesting the ‘Hello World’ sample application from Tomcat directly on port 8080 with the result shown here.

The final step is to request the same ‘Hello World’ sample application using port 80 so that the request will be handled by IIS before being forwarded to Tomcat. If everything is configured correctly you should see the sample application load successfully as shown here.

If you now examine the IIS log file (which can be found in C:\inetpub\logs\LogFiles unless you moved it) you will see the request for the sample application being handled by IIS over port 80. One behaviour change that I have noticed is that the actual resource being requested isn’t logged with IIS 7.0 whereas it was in IIS 6.0, although I think this is likely to be a change in the bahviour of the ISAPI filter itself rather than any change in how IIS logs requests.

That’s It. I think it will help all of my visitors to have the solution for their problems. If have any Problems please feel free to post comments right here.

Advertisements

46 responses to this post.

  1. It’s really a great and useful piece of info. I’m satisfied that you simply shared this useful information with us. Please stay us up to date like this. Thanks for sharing.

  2. Hello there, simply turned into aware of your blog thru Google, and found that it is really informative. I’m gonna watch out for brussels. I will appreciate if you continue this in future. A lot of other folks will be benefited from your writing. Cheers!

  3. Thanks for your marvelous posting! I really enjoyed reading it, you’re a great author.I will be sure to bookmark your blog and will eventually come back later on to read more about asthma problems. I want to encourage yourself to continue your great posts, have a nice day!

  4. I’m impressed, I have to say. Really not often do I encounter a weblog that’s both educative and entertaining, and let me tell you, you could have hit the nail on the head. Your idea is outstanding; the difficulty is one thing that not sufficient individuals are speaking intelligently about. I’m very pleased that I stumbled across this in my seek for one thing referring to this.

  5. thanks for the support and liking our blog posts.

  6. Howdy! This post could not be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this post to him. Pretty sure he will have a good read. Thank you for sharing!

  7. Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I acquire actually enjoyed account your blog posts. Anyway I’ll be subscribing to your augment and even I achievement you access consistently fast.

  8. Hey there, You have done an excellent job. I’ll certainly digg it and personally suggest to my friends. I am confident they’ll be benefited from this website.

  9. Would like to start squidoo lens building service? Or, do you want to learn to build squidoo lens?I’ve a video tutorial on how to build squidoo lens.

  10. That is definitely some truly good advice because people are leaning a lot of new money makin ideas, I well I sure am from the submit. Terrific get the job done and keep it up

  11. Great collection..will try my self to make this type of patterns.wonderful inspiration!great operate..!

  12. Spoken like a long-term loyal Incubator member, David! Many thanks and thanks for being such a great member with the incubator. But we haven’t gotten enough questions from you lately!

  13. I adore this website layout . How do you make it. It is so sweet.

  14. I had been wondering if you ever considered replacing the page layout of your website? Its very well written; I enjoy what you have got to say. But maybe you can add a little more in the way of content so people might connect to it better. You have got an awful lot of wording for only having one or two graphics. Maybe you could space it out better?

  15. Cool post . Cheers for, writing on my blog mate. I will message you soon! I didnt know that!

  16. Hey there, I just hopped over to your web page through StumbleUpon. Not somthing I might normally read, but I appreciated your thoughts none the less. Thanks for making something well worth browsing.

  17. Just to let you know your web page looks a little bit strange in Firefox on my computer with Linux .

  18. Dude. This blog site is amazing. How did you make it look this good .

  19. Have you considered including some social bookmarking links to these blogs. At the very least for twitter.

  20. How do you make your blog look this sick!? Email me if you can and share your wisdom. Id be appreciative!

  21. Just discovered this site thru Bing, what a way to brighten up my month!

  22. An cool blog post right there mate . Cheers for that !

  23. Have you given any kind of thought at all with translating your current website in to Spanish? I know a small number of translaters right here which might help you do it for no cost if you wanna make contact with me personally.

  24. An interesting blog post there mate ! Thanks for that !

  25. If you could message me with some hints about how you made your site look this good , I would be thankful.

  26. Is it okay to place a portion of this in my personal weblog if perhaps I submit a reference to this website?

  27. This is really a wonderful web site, could you be interested in making time for an interview concerning just how you created it? If so e-mail me and my friends!

  28. Mate. This blog is cool. How did you make it look like this !

  29. I enjoy your wp template, where did you get a hold of it?

  30. The catchy blog with the interesting posts. You give the very useful information that many people dont know before. most of your contents are make me have more knowledge. it is very different. I was impressed with your website. Never be bored to visit your website again. Have the nice your time.Keep enjoyed your blogging.

  31. This is a lovely post. Thanks for that a lot 🙂

  32. Do you like it to have an erotic date with a girl, woman, boy or men? Check out our site for real sex contact!

  33. Nice website over here! I’ll just wanna say thnx for that. If you like to visit my website check it out! thanks for visiting!

  34. When I first saw this title 301 Moved Permanently on google I just whent and bookmark it.Thanks for your marvelous posting! I truly enjoyed reading it, you could be a great author.I will always bookmark your blog and may come back in the future. I want to encourage you to definitely continue your great writing, have a nice weekend!

  35. Wow, awesome blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is great, as well as the content!. Thanks For Your article about Debugging : How To Configure IIS 7.0 and Tomcat on Windows Server 2008 Denno Secqtinstien Foundation .

  36. Excellent post at Debugging : How To Configure IIS 7.0 and Tomcat on Windows Server 2008 Denno Secqtinstien Foundation. I was checking constantly this blog and I am impressed! Extremely helpful information specifically the last part 🙂 I care for such info much. I was looking for this particular info for a very long time. Thank you and best of luck.

  37. Not so poor. Intriguing things right here

  38. When I first saw this title 301 Moved Permanently on google I just whent and bookmark it.F*ckin’ awesome things here. I am very satisfied to peer your article. Thanks a lot and i am looking forward to contact you. Will you please drop me a mail?

  39. Internet is a source of information and knowledge. But there are so many sites in net which are nothing but gibberish. But when I visit your site – I felt that – in net there are lots of sites (like this) from where I can get lot of information too. And if I say truly – your site is fantastic. I’ve bookmarked your site in my browser; I hope in future days I’ll get more valuable information from your site.

  40. is there a right way to make iis6 and tomcat 7 redirection?
    I couldnt get this working. please help

  41. You have very nice blog here. Only one thing what I noticed, it was very hard to find it from google (at least with my search term). You should try this: http://bit.ly/11UpQn2 It will get you better ranking in google. I use it all my wp blogs.If you have any problems to use it, just send me email and I try to help. If you dont have wp, check this out: http://bit.ly/13T2ILb

  42. Always a massive fan of linking to bloggers that I really like but really don’t get a good deal of link like from.

  43. Always a major fan of linking to bloggers that I like but really don’t get a lot of link appreciate from.

  44. Very couple of web sites that come about to become comprehensive below, from our point of view are undoubtedly nicely really worth checking out.

  45. Zune and iPod: Most people compare the Zune to the Touch, but after seeing how slim and surprisingly small and light it is, I consider it to be a rather unique hybrid that combines qualities of both the Touch and the Nano. It’s very colorful and lovely OLED screen is slightly smaller than the touch screen, but the player itself feels quite a bit smaller and lighter. It weighs about 2/3 as much, and is noticeably smaller in width and height, while being just a hair thicker.

  46. When I first saw this title Debugging : How To Configure IIS 7.0 and Tomcat on Windows Server 2008 | Denno Secqtinstien Foundation on google I just whent and bookmark it. Hi, i believe that i saw you visited my weblog so i came to “return the favor”.I’m searching for things to improve my website!I suppose its okay to use a few of your concepts!!

Comments are closed.

%d bloggers like this: