ITPub博客

首页 > Linux操作系统 > Linux操作系统 > IIS5.0和Tomcat6.0进行整合

IIS5.0和Tomcat6.0进行整合

原创 Linux操作系统 作者:china50 时间:2011-03-28 15:29:27 0 删除 编辑

一、前提说明:
为了能够通过IIS访问Servlet程序,所以打算把IIS和Tomcat进行整合,本来想参照网上的资料,但是都没有成功,最后是通过对Apache的Tomcat JK的文档和源代码研究,获得下面的配置方法。本文档中方法是使用Tomcat的JK连接器进行IIS和Tomcat的整合。

二、部署的环境:
WindowsXP + IIS5.0 + Tomcat6 + JK1.2.31 + JDK1.5

三、整合步骤:
1、从Apache(www.apache.org)网站下载Tomcat的连接器JK1.2.31。
(1)从http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.31/下载isapi_redirect-1.2.31.dll文件
(2)从http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.31/下载JK的源代码文件tomcat-connectors-1.2.31-src.zip

2、在tomcat的bin目下新建jk目录,把isapi_redirect-1.2.31.dll复制到jk目录下。
3、从源代码的压缩文件中的tomcat-connectors-1.2.31-src\conf\目录取得workers.properties.minimal和uriworkermap.properties文件,把这两个文件放到tomcat的conf目录下,并把workers.properties.minimal文件改名为workers.properties。

3、配置ISAPI Redirector
配置ISAPI Redirector请使用下面的reg文件,其中C:\\tomcat是你机器上tomcat6的安装目录。
iis_tomcat.reg文件内容如下。
--------------------------------------------------------------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0]
"extension_uri"="/jakarta/isapi_redirect-1.2.31.dll"
"log_file"="C:\\tomcat\\logs\\isapi.log "
"worker_file"="C:\\tomcat\\conf\\workers.properties"
"worker_mount_file"="C:\\tomcat\\conf\\uriworkermap.properties"
"log_level"="debug"
"uri_select"="parsed"
--------------------------------------------------------------------------------

4、在IIS中创建虚拟目录jakarta,并且这个名字一定要是jakarta,这个虚拟目录要指向isapi_redirect-1.2.31.dll所在的目录,同时执行权限选择“脚本和可执行文件”。

5、重新启动IIS5和tomcat6。
注:在重启IIS5时,用services.msc启动Services管理器,选择IIS Admin项,进行重启。

6、访问http://localhost/examples/index.html,如果能够正常访问,则说明整合已经成功。

备注:关于JK的官方说明文档中关于ISAPI Filter配置部分,在我最初配置过程,把这项工作做了,结果出现了Tomcat Connector error "did not find a worker ajp13",通过调查发现把ISAPI Filter配置删除之后,按上面的步骤就能够实现IIS5和Tomcat6的整合。

四、附录(worker.properties和uriworkermap.properties)
-------------------------------------------------------------------------------
1.  worker.properties
-------------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# workers.properties.minimal -
#
# This file provides minimal jk configuration properties needed to
# connect to Tomcat.
#
# The workers that jk should create and work with
#

worker.list=wlb,jkstatus

#
# Defining a worker named ajp13w and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13w.type=ajp13
worker.ajp13w.host=localhost
worker.ajp13w.port=8009

#
# Defining a load balancer
#

worker.wlb.type=lb
worker.wlb.balance_workers=ajp13w

#
# Define status worker
#

worker.jkstatus.type=status


-------------------------------------------------------------------------------
2.  uriworkermap.properties
-------------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# uriworkermap.properties - IIS
#
# This file provides sample mappings for example wlb
# worker defined in workermap.properties.minimal
# The general syntax for this file is:
# [URL]=[Worker name]

/admin/*=wlb
/manager/*=wlb
/jsp-examples/*=wlb
/servlets-examples/*=wlb
/examples/*=wlb

# Optionally filter out all .jpeg files inside that context
# For no mapping the url has to start with exclamation (!)

!/servlets-examples/*.jpeg=wlb

#
# Mount jkstatus to /jkmanager
# For production servers you will need to
# secure the access to the /jkmanager url
#
/jkmanager=jkstatus

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/1365/viewspace-691140/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-06-24

  • 博文量
    25
  • 访问量
    42005