(灰狐动力-中间件技术论坛 by huihoo.com Etre)
Apache,Jboss3.0-Tomcat4.03整合
Operator System: windows 2000 server 2
Application server: Jboss3.0-tomcat4.03
DB: Oracle8.17
JDK: jdk1.31
Web Server Apache1.3
一、 首先安装好Apache,Jboss3.0-Tomcat4.03我安装在E:Jboss3.0_Tomcat4.03和E:WebServerApache目录下
二、编缉tocmat-service.XML文件如下
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set catalina.home to the location of the Tomcat-4.x dist.
The default value is that of the JBoss/Catalina bundle where the
jakarta-tomcat-4.0.3-LE-jdk14 is included as jboss_dist/catalina
-->
<!DOCTYPE server [
<!ENTITY catalina.home "../catalina">
]>
<!-- The service configuration for the embedded Tomcat4 web container
-->
<server>
<classpath codebase="file:&catalina.home;/common/lib/" archives="*"/>
<classpath codebase="file:&catalina.home;/server/lib/" archives="*"/>
<classpath codebase="file:&catalina.home;/bin/" archives="*"/>
<classpath codebase="file:&catalina.home;/lib/" archives="*"/>
<classpath codebase="." archives="tomcat4-service.jar"/>
<mbean code="org.jboss.web.catalina.EmbeddedCatalinaServiceSX"
name="jboss.web:service=EmbeddedCatalinaSX">
<attribute name="CatalinaHome">&catalina.home;</attribute>
<!-- Uncomment this if you want interval snapshot for the
session clustering.
<attribute name="SnapshotMode">interval</attribute>
<attribute name="SnapshotInterval">2000</attribute>
-->
<attribute name="Config">
<Server>
<Service name = "JBoss-Tomcat">
<Engine name="MainEngine" defaultHost="localhost">
<Logger className = "org.jboss.web.catalina.Log4jLogger"
verbosityLevel = "trace" category = "org.jboss.web.localhost.Engine"/>
<Host name="localhost">
<Valve className = "org.apache.catalina.valves.AccessLogValve"
prefix = "localhost_access" suffix = ".log"
pattern = "common" Directory = "../server/default/log" />
<DefaultContext cookies = "true" crossContext = "true" override = "true" />
</Host>
</Engine>
<!-- A HTTP Connector on port 8080 -->
<Connector className = "org.apache.catalina.connector.http.HttpConnector"
port = "8080" minProcessors = "3" maXProcessors = "10" enableLookups = "true"
acceptCount = "10" debug = "0" connectionTimeout = "60000"/>
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" />
</Service>
</Server>
</attribute>
</mbean>
</server>
其中这里是最重要的:
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" />
和Apache的连接在这里定义的。
三、下载mod_jk.dll从这里下载http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.3/bin/win32/i386/mod_jk.dll
下载后考到Apache的modules目录下。
四、编辑 Apache的conf目录下的http.conf文件。在最后加入如下的几行
LoadModule jk_module modules/mod_jk.dll
<IfModule mod_jk.c>
JkWorkersFile conf/workers.properties
JkLogFile logs/jk.log
JkLogLevel warn
JkMount /*.jsp ajp13
JkMount /web/* ajp13
JkMount /jmx-console/* ajp13
</IfModule>
//这个加的东东你可以自己跟自己的情况变化的
其中都在/jmx-console/和/web/都在Jboss3.0-Tomcat4.03发布的web应用所以在你添加这些前至少可以通过8080访问这/jmx-console/和/web/的及http://localhost:8080/jmx-console/和http://localhost:8080/web/是成功的。
四、保存下列为workers.properties文件
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.ajp13.cachesize
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13
上面这些是实现的最小元素。当然你是可以加的啊。面conf/http.conf中指定这个文件如JkWorkersFile conf/workers.properties我放在了conf目录下,及和http.conf同目录。
起apache和jboss-tomcat后,http://localhost/jmx-console/和http://localhost/web/是成功的浏览,一切OK
(出处:http://www.knowsky.com)