Best viewed in 1024 X 800 resolution... Leave a comment if u like an article...
Google
 
Web tezcols.blogspot.com

Tuesday, February 13, 2007

TOMCAT IIS CONNECTOR

Is your superior asking you to deploy Java stuff on IIS ? Are you using TOMCAT web server instead ?

uhhhh... don't bother... u got it...

Im gonna tell u connecting tomcat webserver to IIS. Requests that need java engine will be forwarded from IIS to tomcat and get the response without the knowledge of the web user.

I guess u hav

I am using Windows XP and I have

  • J2SDK installed at C:\Program Files\Java\jdk1.6.0
  • Tomcat installed at C:\Program Files\Apache Software Foundation\Tomcat 5.0 with default port 8080 configured.
  • CATALINA_HOME and JAVA_HOME environment variables (System Variables) configured.
  • Make sure that no other application is running on port 80 so that IIS can run on its default port 80. Change the port numbers and make sure of the IIS port number being used.

Extract the connectors-jk2.0.4-win32-IIS.zip and copy isapi_redirector2.dll to TOMCAT_HOME/bin/win32/i386. If you dont have the win32 and i386 folders just create new one and then copy to i386.


To support the JK2 Connector, you might need to edit the jk2.properties file. In most cases though, the default settings adopted by Tomcat are correct and the contents of jk2.properties can remain commented out.You can find jk2.properties in TOMCAT_HOME/conf directory. If you don't have one jus create a file with the name jk2.properties and copy the following text into the jk2.properties file


## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED

## WHEN YOU EDIT THE FILE.

## COMMENTS WILL BE _LOST_

## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.

# Set the desired handler list

# handler.list=apr,request,channelJni

#

# Override the default port for the socketChannel

# channelSocket.port=8019

# Default:

# channelUnix.file=${jkHome}/work/jk2.socket

# Just to check if the the config is working

# shm.file=${jkHome}/work/jk2.shm

# In order to enable jni use any channelJni directive

# channelJni.disabled = 0

# And one of the following directives:

# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

# If set to inprocess the mod_jk2 will Register natives itself

# This will enable the starting of the Tomcat from mod_jk2

# apr.jniModeSo=inprocess


Now create a file with the name workers2.properties if you dont have and copy the following into the file


[shm:]info=Shared memory file. Required for multiprocess servers

file=C:\Program Files\Apache Software Foundation\Tomcat 5.0\jk2.shm

size=1000000

[channel.socket:localhost:8009]

info=Ajp13 worker, connects to tomcat instance using AJP 1.3 protocol

tomcatId=localhost:8009

[uri:/jsp-examples/*]

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

context=/jsp-examples


The IIS redirects every request to 'context' attribute mentioned above.Requests to

http://localhost/jsp-examples/ (IIS) will be redirected to http://localhost:8080/jsp-examples/ (Tomcat server). You can include more than one context attribute from the next line.

Now some settings to the Windows Registry are to be made so that the redirector will read when it is loaded by the IIS.
create a file with the name isaapi_redirector2.reg preferably in TOMCAT_HOME\bin\win32\i386. Right click and select edit. Copy the following text into it.


Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\2.0]

"workersFile"="C:\\Program Files\\Apache Software Foundation\\Tomcat 5.0\\conf\\workers2.properties"

"extensionUri"="/jakarta/isapi_redirector2.dll"

"logLevel"="debug"

"serverRoot"="C:\\Program Files\\Apache Software Foundation\\Tomcat 5.0\\"

Before saving make sure that 'workersFile' attribute points to the workers2.properties just created and 'serverRoot' points to your tomcat home directory. Save the file. Again right click and select Merge.

If you dont have IIS installed go to Control panel ---- Add or Remove Programs ---- Add/Remove Windows Components---- enable Internet Information Services (IIS) and install.
Now go to Control panel --- Administrative Tools and launch Internet Information Services.
Expand the tree LOcal Computer and you wil find 'Web Sites'.Right click on it and select 'Properties'. Now select 'ISAPI Filters' tab. Click Add button. Enter the Filter Name (Tomcat Connector) and Browse for isapi_redirector2.dll. Click OK and Apply on ISAPI Filters tab.
Expand the 'Web Sites' node and u wil find 'Default Website'. Right click on it and create a virtual directory with the name 'jakarta' in TOMCAT_HOME\bin\win32\i386. Click Next and ensure that Execute is checked. Click Next.

Set Tomcat Server to auto start. To do this do it through services.exe or right click on the tomcat icon at the taskbar and check Auto start option.
Right click on the 'local computer' node in IIS ---- All tasks --- Restart IIS. Click OK
Thats it......
Try

http://localhost:8080/jsp-examples/ by typing in you explorer.The response given is directly from Tomcat.Now try http://localhost/jsp-examples/ . The same response will be given through IIS.Change the port number in the addresses if required.

Send me a comment if this article helped u...

tezcols


Labels:

1 Comments:

Anonymous Anonymous said...

Can anyone recommend the top performing Script Deployment tool for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central it management
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

9:29 PM  

Post a Comment

<< Home