欢迎光临
我们一直在努力

Apache2.0.47和Tomcat4.1.27整合过程-JSP教程,J2EE/EJB/服务器

建站超值云服务器,限时71元/月

参考了网上很多资料,发现大都或多或少有些小问题,现把我的整合过程贴出来,供大家参考。

一、准备

需要以下程序:

j2sdk1.4.2_01,apache-2.0.47,jakarta-tomcat-4.1.27,以及mod_jk2-2.0.43.dll

以上程序都可以在sun和apache.org下载到。

j2sdk1.4.2_01 : http://java.sun.com/j2se/1.4.2/download.html选j2se v 1.4.2_01 的sdk

apache-2.0.47 : http://apache.linuxforum.net/dist/httpd/binaries/win32/apache_2.0.47-win32-x86-no_ssl.exe

tomcat-4.1.27 : http://apache.linuxforum.net/dist/jakarta/tomcat-4/binaries/jakarta-tomcat-4.1.27.exe

mod_jk2-2.0.43.dll : http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.2/bin/win32/mod_jk2-2.0.43.dll

注意下载的jk2文件名:mod_jk2-2.0.43.dll,而网上还有mod_jk-2.0.4x.dll,这是jk而不是jk2

二、安装

假设j2sdk1.4.2_01安装到d:\j2sdk1.4.2_01下,用[java_install_dir]代表此路径

apache-2.0.47安装到d:\program files\apache group\apache2,用[apache_install_dir]代表此路径,服务端口为80

jakarta-tomcat-4.1.27安装到d:\program files\apache group\tomcat 4.1,用[tomcat_install_dir]代表此路径,服务端口为8080

在系统环境变量里添加java_home和tomcat_home分别为以上路径,再修改class_path,添加%java_home%\lib;%tomcat_home%\bin;

安装时把apache和tomcat都设置为后台服务方式运行。

三、配置

1. 在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

2. 配置apache端

[在apache_install_dir]/conf目录中新建文件workers2.properties,内容如下:

# 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\tomcat.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=[apache_install_dir]\logs\stdout.log

stderr=[apache_install_dir]\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

#注:

#网上有资料opt=-djava.class.path是指向\lib\,实际上安装目录下并无\lib目录,如不修改会出现java.lang.noclassdeffounderror: org/apache/jk/apr/tomcatstarter异常

#把[tomcat_install_dir]和[apache_install_dir]换成实际安装路径,其余不用做任何改动

3. 配置tomcat端

修改[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

#注:

#把[tomcat_install_dir]和[apache_install_dir]换成实际安装路径,其余不用做任何改动

#这种方式使用jni通道,因此运行apache时会通过jni直接在后台启动tomcat。

四、测试:

启动apache

看http://localhost/examples/jsp/

如显示正确内容则整合成功!

如不成功请检查[apache_install_dir]\logs\stdout.log和[apache_install_dir]\logs\stderr.log日志,看是什么错误,根据错误提示进行修改。

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Apache2.0.47和Tomcat4.1.27整合过程-JSP教程,J2EE/EJB/服务器
分享到: 更多 (0)

相关推荐

  • 暂无文章