How to use the JK2 connector to configure Tomcat 5.0.x and IIS 5.0 collaborative work

xiaoxiao2021-03-06  82

2004.5 士 睿 QQ: 10743383

Online reprint, please retain the author statement, profit printing publication, please contact Zself@vip.cc163.com

All operations in this article have been tested under the Window2000 Advance Server and Window2000 Professional PROFESSIONAL

All content: New IIS5.0 Tomcat5.0.x HOWTO Topics Forum: http://hh.cc163.com/form/cgi-bin/forumus.cgi? Forum = 4 Home: http: //hh.cc163 .com /

table of Contents

Preface summary preparation download

Java 2 SDK 1.4.2 (or higher) Tomcat 5.0.24 (or higher) Tomcat Web Server Connector Installation

Java 2 SDK Tomcat 5 Tomcat JK2 IIS Connector Settings

Tomcat Tomcat IIS Connector Windows IIS

Set ISAPI Filter Creating a Virtual Directory for ISAPI Filters Restart IIS Service Test

Tomcat IIS reference

sequence

Recently, I have encountered a project, and I cannot avoid coordination of IIS and Tomcat, and analyze the ASP and JSP two scripting languages. View Tomcat official HOWTO, several operations have not been successful. View online discussion, discovering that Chinese data introduction is the configuration method of Tomcat4.x version, and the old is no longer applicable. Later, I was successful after comparing multiple English materials, learning and operation. In view of discussing the lack of Chinese information in this issue, I decided to organize my configuration process, I hope to help with the same good. This article discusses the content, writing formats in the style of http://virtualict/support/kb/iis6-tomcat5-jk2.html, and references some of the text. In the process of IIS, Apache Tomcat, JK2, etc., IIS, Apache Tomcat, JK2, etc., and even sometimes misleading, and to increase the problem of solving problems, I look forward to discussing with you.

I have the environment for Window2000 Professional SP4 (Window2000 Advance Server SP4) IIS 5.0J2SDK1.4.2_04jakarta-Tomcat-5.0.24jakarta-Tomcat-Connectors-JK2.0.4

The path involved in the configuration process is not a special instructions, it is not a system requirements, you can modify it to accommodate your machine's environment.

Here is another automatic installer, how to use this article does not discuss ISAPI Redirector JK2.02 Installer - Integrating Tomcat with IIS

Summary

This is an article telling how to install, configure Tomcat 5 Java Servlet & JSP services to Microsoft IIS 5.0 servers. This article is a summary of its own configuration processes and experience, and recommends some documents that have given a great help. Friends who have mastered methods can complete the entire configuration process for only 15 minutes.

Ready to work

Microsoft Windows 2000 Professional, IIS5 has been installed and working properly

The software that needs to be downloaded:

Java 2 Standard Edition Software Development Kit 1.4.2.04 (or later) JAKARTA TOMCAT 5.0 (or later) JAKARTA TOMCAT Connectors-JK2.0.4 (or higher)

download

Due to the problem of version update, the exact download address of the software is not given here, but the user can easily find the exact address of the software according to the following link users.

Java 2 SDK 1.4.2 (or higher)

From java.sun.com/downloads/ Select The J2SE 1.4.2 (or higher) All platforms and follow the prompt to enter the file list page, download the file

Tomcat 5.0.24 (or higher)

Compilation version of the for Win from Apache Jakarta. Tomcat 5.x should be at the bottom of the page. When this article is written, Tomcat has released version 5.0.2, but the configuration process is the same.

Select 5.0.24 executable (or higher)

Tomcat Web Server Connector

Also download page in Apache Jakarta. The Tomcat Web Server connector is under the Tomcat 5.0.24 link

Select the JK2 compilation version

Select Win32, then select Download Jakarta-Tomcat-Connectors-jk2.0.4-win32-iis.zip

Note that the file name displayed by this directory is truncated, so you need to observe the prompt in the browser status bar, confirm that the file you prepare to download should be ended with "... Iis.zip"

installation

It is recommended that you put the downloaded files in the same folder.

Java 2 SDK

Run J2SDK-1_4_2_04-windows-i586-p.exe follows the prompt installation

You can change the place where the installation path to your habits can be changed.

Tomcat 5

Run Jakarta-Tomcat-5.0.24.exe follows the prompt installation.

If you want to change the installation path, you can operate this step.

You can change to other paths, such as C: / Tomcat 5.0

Set password, keep your password, do not recommend empty password.

This step is to select the JDK path of the local machine. In general, the installation file automatically searches and displays. If it is not displayed correctly, you can also change it.

After successful installation, the program will prompt to start Tomcat and view the ReadMe document.

Note: Before starting Tomcat, you must determine that there is no other service that has taken 8080 port (Tomcat default port) and 8009 port (Tomcat's AJP13 connector port)

Tomcat will load icons in the system bar after normal startup.

You can see some settings items on the icon.

Click Configure ... See the display as follows, select Startup Type to start automatically for Automatic.

Tomcat JK2 IIS Connector

Unzip JAKARTA-TOMCAT-CONNECTORS-JK2.0.4-WIN32-IIS.ZIP gets the following folder

Enter / bin / after visible

Shearing / Copy Isapi_Redirector2.dll file to tomcat's bin / directory

New Directory WIN32 / I386 / and paste Isapi_Redirector2.dll.

Remember this path, it will be used when you configure IIS. This path is not the system requirements, can change!

Now you can delete the Jakarta-Tomcat-Connector-JK2.0.4-Win32-IIS directory, which is no longer available. In fact, we only use the ISAPI_Redirector2.dll in Jakarta-Tomcat-Connectors-jk2.0.4-win32-iis.zip

Set

Tomcat

Enter the Tomcat's conf / folder.

To support the JK2 connector, you may need to modify the JK2.Properties file. Most cases reserved the default state of this file, I have not modified this file in my multiple configuration procedures.

## This file may be overriden at runtime. Make sure tomcat is stock

## w 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 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 backing directives:

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

# I set to inprocess the mod_jk2 will register native itself

# This will enable the starting of the tomcat from mod_jk2

# apr.jnimodeso = inprocess

Now I am now created yourself. The content is as follows (there is a copy in the attachment) to pay attention to the path of "C: / Tomcat 5.0 / Work /" to your own path, And JK2.SHM doesn't have to worry, it doesn't matter if it doesn't matter, it will be automatically created when needed.

[shm:]

Info = shared memory file. Required for multiprocess Servers

FILE = C: / Tomcat 5.0 / Work / 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

[URI: / servlets-example / *]

Info = servlet Examples, Map Requests for All servlets to tomcat.

Context = / servlets-esamples

I have seen online discussions, some friends are in the process of configuring the problem, so many more words: This file specifies the catalog of JSP, that is, "http://xxxx/dir/aa.jsp" this "DIR" in the URL, such as adding / dir / this path in our website, and makes the JSP below this path can be parsed, then you need to add such a word in the workers2.properties file.

[URI: / DIR / *] INFO = JSP Examples, Map Requests for All JSP Pages To Tomcat. Context = / DIR

And build "/ DIR /" in the working directory of Tomcat. For example, we now, Tomcat's working directory is the default "/ root /", then we need to create a new "/ dir /" directory under the "/ root /" path and place the AA.JSP file. After the service is restacked, we can access the AA.JSP file with the URL such as "http: //xxxx/dir/aa.jsp". In the past, some friends mistakenly thought that "DIR" is the path in the IIS working directory, and the page cannot be displayed at runtime, or the JSP code is not parsed, in fact, this is the problem of this path setting. It is worth noting that if the IIS and Tomcat's working directory exists at the same time, the server connects this path to Tomcat processing. When your Tomcat and IIS work together, you can modify this file at any time to add a new directory to support JSP operation. Here is the more rules for this file for Worker2.Properties.

Right click on the Tomcat service icon in the system bar, select "STOP Service", turn off the service.

Find the "Apache Tomcat" service in Administrative Tools - Services, and make sure it has been started.

Tomcat IIS connector

You have already placed isapi_redirector2.dll under your path, this example is C: / Tomcat 5.0 / bin / Win32 / i386

Now you need to add some necessary registration information to the registry, Redirector is read when called by IIS. Create a .reg file

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE / SOFTWARE / Apache Software Foundation / Jakarta Isapi Redirector / 2.0] "workersFile" = "C: // Tomcat 5.0 // conf // workers2.properties" "extensionUri" = "/ jakarta / isapi_redirector2.dll" "logLevel" = "Debug" "ServerRoot" = "c: // tomcat 5.0 //"

Write the text above in Notepad and save it as reg.reg (there is a copy in the attachment)

Double click .reg file

Success shows the following:

You can see in the registry:

You can now delete this .reg file.

Windows

Add two system environment variables, they are Catalina_Home and Java_home.

Right click on "My Computer" on the desktop, select "Property - Advanced - Environment Variable"

Catalina_Home points to your Tomcat installation directory, this example is C: / Tomcat 5.0

Java_home points to the Java SDK installation directory, this example is C: /J2SDK1.4.2_04

IIS

Install ISAPI filter

Enter the ISAPI filter interface

Click Add button to type a new filter name, the name can be casually

Click the Browse button, select Isapi_Redirector2.dll. This example is C: / Tomcat 5.0 / Bin / Win32 / I386 / ISAPI_Redirector2.dll

Click OK. After IIS restart, the new filter will take effect, let us not wear, then do it later.

Click OK to save your modification, exit the site properties dialog.

Note: You can select a specific site for settings, add filters, or increase the filter on all sites to the "computer" on the left side of the IIS tree, call out the properties, select Edit to call the primary property dialog The box is called the primary property dialog and add a filter.

Create a virtual directory required for filters

Select to load the Tomcat service site, right click to select New, then select the virtual directory

Create a virtual directory, alias is Jakarta. Note that this name is a fixed value, don't spell your error!

The specified directory is ISAPI_Redirector2.dll where the directory is located. This example is C: / Tomcat 5.0 / Bin / Win32 / I386

Select execution to make it available

Once you have successfully established a virtual directory, you should see it as shown below.

Restart IIS service

Select the computer, right, select Restart IIS

Select Restart Internet Service, click OK

Operating System Management Tools - Event Viewers You can view the boot status of the service, isapi_redirector2.dll writes its error information to the event viewer, not like an earlier version to write into a file.

After starting, you can see the status of the Tomcat connector after the IIS console, the list of the Tomcat connector, and it is right.

test

Tomcat

First test the example of the Tomcat installation can run, use Tomcat's own server and port

Test server servlets: http: // localhost: 8080 / servlets-example /

Test server JSP: http: // localhost: 8080 / jsp-example /

Test Tomcat Management interface: http://127.0.0.1:8080/admin/

IIS

Now we have access to the same example in IIS to test whether the connector work, pay attention to the modification address and port meet your IIS.

http: // localhost / servlets-examples /

http: // localhost / jsp-example /

If everything is normal, you have made IIS5 to parse the JSP & Servlet program under the work of Tomcat JK2 IIS connector, congratulations on you.

转载请注明原文地址:https://www.9cbs.com/read-106491.html

New Post(0)