Topic: [求助]Apache 2.0.46+Tomcat 4.1.24整合

  Print this page

1.[求助]Apache 2.0.46+Tomcat 4.1.24整合 Copy to clipboard
Posted by: redmiddle
Posted on: 2003-07-08 15:01

看了好几篇文章.用Jk或者用JK2的方法就是死活不行.有人能指点一下需要特别注意些什么东西不?谢谢.

2.转贴 CHINAJAVAWORLD ,作者 rmouse [Re: redmiddle] Copy to clipboard
Posted by: wyan716
Posted on: 2003-07-15 13:28

本文介绍的配置方法,用JK2连接Apache和Tomcat,连接使用JNI通道。并且启动Apache时,Apache会通过JNI直接在后台启动Tomcat,无须你再手工启动Tomcat。
我是参考Apache网站的资料,并在自己Win2K上配置成功。配置过程如下,希望对大家有用。
安装版本:
Apache 2.0.44
Tomcat 4.1.18
mod_jk2-2.0.43.dll
以上版本都可在WWW.APACHE.ORG下载

整合步骤
首先假定Apache2和Tomcat4已经安装完成,安装目录分别为:[Apache_install_dir]和[Tomcat_install_dir]。并且Apache的服务端口为80,Tomcat服务端口为8080。

一:在Apache2中安装mod_jk2-2.0.43.dll
将mod_jk2-2.0.43.dll拷贝到[Apache_install_dir]/modules目录中
编辑[Apache_install_dir]/conf/httpd.conf配置文件,在文件最后添加如下一行:
LoadModule jk2_module modules/mod_jk2-2.0.43.dll

二:配置Apache端
Apache端通过workers2.properties文件使用JK2。
在[Apache_install_dir]/conf目录中新建文件workers2.properties。(注意不要误建成workers2.properties.txt)
编辑该文件,添加如下内容:
# Define the comunication channel
[channel.jni:jni]
info=The jni channel, used if tomcat is started inprocess

# Define the parameters for the Java Virtual Machine
[vm:]
info=Parameters used to load a JVM in the server process
OPT=-Djava.class.path=[Tomcat_install_dir]/bin/tomcat-jni.jar;[Tomcat_install_dir]/bin/bootstrap.jar;[Tomcat_install_dir]/bin/commons-daemon.jar
OPT=-Dtomcat.home=[Tomcat_install_dir]
OPT=-Dcatalina.home=[Tomcat_install_dir]
OPT=-Xmx128M

# JNI worker startup handler
[worker.jni:onStartup]
info=Command to be executed by the VM on startup. This one will start tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=start
stdout=${serverRoot}/logs/stdout.log
stderr=${serverRoot}/logs/stderr.log

# JNI worker shutdown handler
[worker.jni:onShutdown]
info=Command to be executed by the VM on shutdown. This one will stop tomcat.
class=org/apache/jk/apr/TomcatStarter
ARG=stop

# Map the Tomcat examples webapp to the Web server uri space
[uri:/examples/*]
info=Map the whole webapp

注意:其中[Tomcat_install_dir]用你实际安装路径代替,[uri:/examples/*]用于映射Tomcat的examples Webapp,为了后面测试用。

三:配置Tomcat端
Tomcat端通过jk2.properties文件使用JK2。
在[Tomcat_install_dir]/conf目录中已经有jk2.properties文件,用如下内容覆盖原内容:

# Set the desired handler list
handler.list=apr,request,container,channelJni

# Enable jni use channelJni directive
apr.jniModeSo=[Apache_install_dir]\modules\mod_jk2-2.0.43.dll

# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# If you wish to start the Tomcat from inside web server then
# you don't need any above directive. Here is shown the default
# value for the apr that you can ommit
apr.jniModeSo=inprocess

四:测试
以上配置完毕后,整合就成功了。启动Apache。(不必手工启动Tomcat,Apache会自动在后台启动Tomcat,Tomcat的屏幕输出被重新定向到[Apache_install_dir]/logs/stdout.log和stderr.log中。
打开浏览器,访问 http://localhost/examples/
哈哈!成功了没有?

3.Re:[求助]Apache 2.0.46+Tomcat 4.1.24整合 [Re: redmiddle] Copy to clipboard
Posted by: chinavrml
Posted on: 2003-08-27 13:23

jk2是什么?

4.Re:[求助]Apache 2.0.46+Tomcat 4.1.24整合 [Re: redmiddle] Copy to clipboard
Posted by: emarket
Posted on: 2003-08-27 13:44

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/

apach 和 tomcat的连接器

5.Re:[求助]Apache 2.0.46+Tomcat 4.1.24整合 [Re: redmiddle] Copy to clipboard
Posted by: syncsync
Posted on: 2003-08-28 18:51

http://pmfinder.vicp.net:8099/teach/Jsp/ModJk%20Howto.html
flash 教学 ,应该有用


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923