Steps for Integrating IIS (5 and above) with Tomcat (5 and above)
S.Prasanna,
sprasanna199@gmail.com
Introduction:
This article explains the way to integrate IIS (Version 5 and above) with Tomcat (Version 5 and above). Since IIS cannot serve dynamic java contents like servlets and JSPs, the IIS Tomcat connector delegates Tomcat servlet engine to handle servlet and JSP calls. I still couldn't find a good document which clearly explains how to use the install4iis.js (A javascript installer used to configure the IIS Tomcat connector) to make the installation process much simpler. So here's mine.
1. Download the Tomcat IIS Connector (Jk2 binaries) from one of the mirrors
(http://archive.apache.org/dist/tomcat/tomcat-connectors/jk2/binaries/win32/jakarta-tomcat-connectors-jk2.0.4-win32-IIS.zip)
2. Unzip the connector. There will be three directories namely bin, conf and doc. The bin folder has the isapi_redirector2.dll and an installation javascript file install4iis.js. I call the directory where you unzipped the IIS connector zip file as <IIS_CONNECTOR_HOME>.
3. From IIS perspective I assume that the default web site is running and you need to redirect all URIs related to Servlets and jsps for Tomcat to execute them i.e URIs of the form
http://127.0.0.1/servlets-examples and http://127.0.0.1/jsp-examples to Tomcat servlet container URI
http://127.0.0.1:8080/jsp-examples and http://127.0.0.1:8080/jsp-examples respectively.
These are the steps to be executed from Tomcat and IIS.
From Tomcat:
From IIS:
1. Since the default web site is running, invoking the install4iis.js
(<IIS_CONNECTOR_HOME>/bin directory) will be straightforward.
2. Configuring the jakarta filter:
To do this one should create a new virtual directory from the IIS management console.
1. Goto Settings -> Control Panel -> Administrative tools -> Internet Information Services
2. Expand the Local Computer icon.
3. Expand Web sites folder and Default Website.
4. Under the Default Web site create a new virtual directory.
1. Right click Default Web site -> Click New -> Virtual Directory -> Next
2. In the (Alias) Text field enter the name as jakarta and Click next
3. Enter <IIS_CONNECTOR_HOME>/bin as the directory path and Click Next
4. Select read, run scripts and execute access permissions, Click Next and Finish.
5. Configure workers2.properties file:
This file is used to configure the connector properties, the URI pattern to be filtered, and details of the IP address and the port where the Tomcat connector is listening, etc.To map URIs of the form /Servlets-examples and /jsp-examples for Tomcat, the following settings need to be specified in the workers2.properties file.
Create a file workers2.properties in <IIS_CONNECTOR_HOME>/conf directory with the following settings.
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Map the default Tomcat directory to the Web server uri space
[uri:/jsp-examples/*]
group=ajp13:localhost:8009
[uri:/servlets-examples/*]
group=ajp13:localhost:8009
6. Now you are set to execute the IIS Tomcat connector installation script install4iis.js. Either double click install4iis.js or execute it in command line as windows script using
Wscript //E:Jscript install4iis.js
The installation process using install4iis.js will take 10 – 15 steps. Click Ok for all messages in the message box one
after another and finally check for the message
Filter [jakarta] set. Click Ok to complete the installation.
Note: By Default the install4iis.js configures the filter (jakarta, the virtual directory configured above) for the Default
Web Site. If you want to configure the filter for other sites, you need to use the appropriate command line options.
For more help, type Wscript //E:Jscript install4iis.js –h.
7. Restart IIS (In IIS Management console, right click Local Computer -> All tasks -> Restart IIS).
8. To check the configuration of the filter, in the IIS Management console, expand Local Computer -> Web Sites and Right click Default Web Sites and Click Properties and ISAPI Filters tab. There you should see the green status of the jakarta filter indicating that the filter is loaded.
Once the above procedures are completed correctly, then typing
http://127.0.0.1/servlets-examples in browser will fetch the Tomcat page http://127.0.0.1:8080/servlets-examples and http://127.0.0.1/jsp-examples will fetch http://127.0.0.1:8080/jsp-examples page. Try executing the sample Servlets and jsp examples through IIS Connector and check the results.




13 comments:
JK 2 is unsupported. The only supported Tomcat JK connector is JK 1
Hi,
By the time this article was written first, the connector used was JK2 which I used to integrate Tomcat with IIS.
Greate article, thanks!
I'd like to add some additional notes:
1. There should be at least one filter installed at IIS before you run install4iis.js. In other case you'll get this error: "Unable to find the IIsFilters for Default Web Site". I guess the IIsFilters collection is null if no filters installed. For this you can add isapi_redirector2.dll manually, and then run install4iis.js.
2. For Tomcat 6.X you need to change configuration of workers2.properties. Instead of these lines:
[uri:/jsp-examples/*]
group=ajp13:localhost:8009
[uri:/servlets-examples/*]
group=ajp13:localhost:8009
use the following:
[uri:/examples/*]
group=ajp13:localhost:8009
Thanks a lot for your time Yuriy in pointing that out, I will make the enhancements in my next update soon, its been a while I worked in Tomcat.
Hi
You mention that we need to have a running version of Tomcat at port 8080 with jk2 at 8009. My tomcat is runing at port 8080 with ajp 1.3 connector. How can i change this thing?
Thanks
Hi,
The AJP connector runs at port 8009 for any Tomcat versions and its the Tomcat servlet container which listens at port 8080 so the procedure I mentioned should work out for you without any changes.
How to send message from one machine to another machine through socket, where one application is running in C and another in Java.
I am working in C, and I wrote the client program.
Server is running in Java application.
I have the below detials of server.
1.IP address.
2.Port number.
3.Servlet: /SocketListnerServlet
My question is how to connect to the perticular application port which is running in different application in different machine.
Thanks
Girish.L.C
Error processing install4iis.js
Unable to find ADSI object...
The 'Default Web Site' does not exists.
Why?
Hi,
I am not sure which version you are working on, in any case the writing may apply to the version of IIS and Tomcat mentioned or something near.
I am totally new to this , I checked the article sounds very informative.
just tell what exact link should i type to check if my jsp page is working thr' IIS connector?
hi..this is harish.... am new to sockets ... to be frank dnt xctly knw wats a socket.... but nw d problem is socket programming in c++ is a par of my academics... so please suggest me where to start from exactly...
Hi Prasanna,
I am working on python 2.4 and am facing one issue in socket programming.. client is a python program and server side is "C" code. I want to send structure from client side to server side "C" code.Please can you let me know how to create a structure in python and populate the data to a structure and send it to the server side.
Post a Comment