我按要求拷贝了mod_jk-2.0.42.dll到modules目录下,在apache的httpd.conf中加入下面语句:
LoadModule  jk_module  modules/mod_jk-2.0.42.dll
JkWorkersFile  "C:/Tomcat4/conf/workers.properties"
JkLogFile  "C:/Tomcat4/logs/mod_jk2.log
JkMount  /servlet/*  ajp13
JkMount  /*.jsp  ajp13 
-------------------------------
在tomcat中新建一个workers.properties,写上了:
******************************************************************************************** 
# $Header: /home/cvs/jakarta-tomcat/src/etc/Attic/workers.properties,v 1.3.2.2 2000/10/16 01:59:22 larryi Exp $ # $Revision: 1.3.2.2 $ # $Date: 2000/10/16 01:59:22 $ # # # workers.properties - # # This file provides jk derived plugins with with the needed information to # connect to the different tomcat workers. # # As a general note, the characters $( and ) are used internally to define # macros. Do not use them in your own configuration!!! # # Whenever you see a set of lines such as: # x=value # y=$(x)something # # the final value for y will be valuesomething # # Normaly all you will need to modify is the first properties, i.e. # workers.tomcat_home, workers.java_home and ps. Most of the configuration # is derived from these. # # When you are done updating workers.tomcat_home, workers.java_home and ps # you should have 3 workers configured: # # - An ajp12 worker that connects to localhost:8007 # - An ajp13 worker that connects to localhost:8009 # - A jni inprocess worker. # - A load balancer worker # # However by default the plugins will only use the ajp12 worker. To have # the plugins use other workers you should modify the worker.list property. # # # # workers.tomcat_home should point to the location where you # installed tomcat. This is where you have your conf, webapps and lib # directories. # workers.tomcat_home=c:\Apache Tomcat 4.0# # workers.java_home should point to your Java installation. Normally # you should have a bin and lib directories beneath it. # workers.java_home=d:\jdk1.3 # # You should configure your environment slash... ps= on NT and / on UNIX # and maybe something different elsewhere. # ps=\ # ps=/ # #------ ADVANCED MODE ------------------------------------------------ #--------------------------------------------------------------------- # # #------ DEFAULT worket list ------------------------------------------ #--------------------------------------------------------------------- # # # The workers that your plugins should create and work with # worker.list=ajp12, ajp13 # #------ DEFAULT ajp12 WORKER DEFINITION ------------------------------ #--------------------------------------------------------------------- # # # Defining a worker named ajp12 and of type ajp12 # Note that the name and the type do not have to match. # worker.ajp12.port=8007 worker.ajp12.host=localhost worker.ajp12.type=ajp12 # # Specifies the load balance factor when used with # a load balancing worker. # Note: # ----> lbfactor must be > 0 # ----> Low lbfactor means less work done by the worker. worker.ajp12.lbfactor=1 # #------ DEFAULT ajp13 WORKER DEFINITION ------------------------------ #--------------------------------------------------------------------- # # # Defining a worker named ajp13 and of type ajp13 # Note that the name and the type do not have to match. # worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 # # Specifies the load balance factor when used with # a load balancing worker. # Note: # ----> lbfactor must be > 0 # ----> Low lbfactor means less work done by the worker. worker.ajp13.lbfactor=1 # # Specify the size of the open connection cache. #worker.ajp13.cachesize # #------ DEFAULT LOAD BALANCER WORKER DEFINITION ---------------------- #--------------------------------------------------------------------- # # # The loadbalancer (type lb) workers perform wighted round-robin # load balancing with sticky sessions. # Note: # ----> If a worker dies, the load balancer will check its state # once in a while. Until then all work is redirected to peer # workers. worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=ajp12, ajp13 # #------ DEFAULT JNI WORKER DEFINITION--------------------------------- #--------------------------------------------------------------------- # # # Defining a worker named inprocess and of type jni # Note that the name and the type do not have to match. # worker.inprocess.type=jni # #------ CLASSPATH DEFINITION ----------------------------------------- #--------------------------------------------------------------------- # # # Additional class path components. # worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes # # The XML parser provided with Tomcat # worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jaxp.jar worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)parser.jar # # Tomcat`s implementation # worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)jasper.jar worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)servlet.jar worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)webserver.jar # # Javac as available from Java2SE # worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar # # Setting the command line for tomcat # Note: The cmd_line string may not contain spaces. # worker.inprocess.cmd_line=-config worker.inprocess.cmd_line=$(workers.tomcat_home)/conf/jni_server.xml worker.inprocess.cmd_line=-home worker.inprocess.cmd_line=$(workers.tomcat_home) # # The JVM that we are about to use # # This is for Java2 # worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll # # And this is for jdk1.1.X # #worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll # # # Setting the place for the stdout and stderr of tomcat # worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr # # Setting the tomcat.home Java property # worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home) # # Java system properties # # worker.inprocess.sysprops=java.compiler=NONE # worker.inprocess.sysprops=myprop=mypropvalue # # Additional path components. # # worker.inprocess.ld_path=d:$(ps)SQLLIB$(ps)bin # 
*******************************************************************************************
tomcat的server.xml中,修改后为  
....... 
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="0"
               useURIValidationHack="false"
               protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>    <!-- Define an AJP 1.3 Connector on port 9000 -->
    
    
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
               port="9000" minProcessors="5" maxProcessors="75"
               acceptCount="10" debug="0"/>
.......
到底错那里了,请高手指点!先

解决方案 »

  1.   

    上面的其中几句应为:
    workers.tomcat_home=c:\Tomcat\tomcat4.1.18
    # # workers.java_home should point to your Java installation. Normally # you should have a bin and lib directories beneath it. # workers.java_home=c:\j2sdk1.4.1_02
      

  2.   

    在精华区的一篇文章,你参考一下吧
    四、整合配置:  
           对Apache与Tomcat做相应的配置,让其共同为你工作。  
           若Apache2与Tomcat4正运行着,请关闭它们。  
           (1)配置Apache2:  
                     1.先将下载的mod_jk-2.0.42.dll复制到C:\Apache2\modules下。  
                 2.设置主页文件类型:打开C:\Apache2\conf下的httpd.conf,查找"DirectoryIndex",在index.html的后面添加index.jsp并保存,注意相互之间应有空格。  
                 3.设置虚拟主机,让Apache自动控制html与jsp的解析:  打开C:\Apache2\conf\httpd.conf,在最后加入下面这段代码并保存。  
                                           <VirtualHost  localhost>    //localhost为本机,你可用本机ip  
                                                 ServerAdmin  [email protected]    //你的mail地址  
                                                 DocumentRoot  E:\Application    //你的项目组根目录,因为Application下有OA及其它多个项目,因此只能设为E:\Application  
                                                 ServerName  localhost                  //你的服务名,若你的机器有域名,设为域名,但现用本机作测试  
                                                 ErrorLog  logs/robornet_home_log.txt    //错误日志,在C:\Apache2\logs下,可用其它任意名字  
                                                 CustomLog  logs/robornet_Custom_log.txt  common  //访问日志,在C:\Apache2\logs下,可用其它任意名字  
                                         </VirtualHost>  
                 4.设置Apache与Tomcat之间的连接,让Apache遇到jsp文件时,在后台将其交由Tomcat去处理:打开C:\Apache2\conf\httpd.conf,在最后加入下面这段代码并保存。  
                                         #  Using  mod_jk2.dll  to  redirect  dynamic  calls  to  Tomcat    
                                         LoadModule  jk_module  modules/mod_jk-2.0.42.dll        //装载模块,用于处理连接  
                                         JkWorkersFile  "C:/Tomcat4/conf/workers.properties"    //设置模块的工作文件,下面会说明  
                                         JkLogFile  "C:/Tomcat4/logs/mod_jk2.log"      //设置模块工作的日志文件,Tocmat启动时会自建  
                                         JkMount  /servlet/*  ajp13        //让Apache支持对servlet传送,用以Tomcat解析  
                                         JkMount  /*.jsp  ajp13                //让Apache支持对jsp传送,用以Tomcat解析  
                     小结:到此Apache的配置基本完成,不过这时启动Apache还不能正常工作。  
           (2)配置Tomcat4:  
                     1.在C:\Tomcat4\conf下新建一个文件workers.properties  注意文件后缀,建议用EditPlus或UltraEdit建立,若用记事本,记得改名,  
                     不要成了workers.properties.txt了!其内容如下:  
                                           workers.tomcat_home=c:\Tomcat4          //让mod_jk模块知道Tomcat  
                                           workers.java_home=c:\j2sdk1.4.1        //让mod_jk模块知道j2sdk  
                                           ps=\  
                                           worker.list=ajp13                                  //模块版本,现有ajp14了,不要修改  
                                           worker.ajp13.port=8009                        //工作端口,若没占用则不用修改  
                                           worker.ajp13.host=localhost            //本机,若上面的Apache主机不为localhost,作相应修改  
                                           worker.ajp13.type=ajp13                    //类型  
                                           worker.ajp13.lbfactor=1                    //代理数,不用修改  
                     2.打开C:\Tomcat4\conf下的server.xml文件:查找到"<!--  Define  a  Coyote/JK2  AJP  1.3  Connector  on  port  8009  -->",将以前的代码:  
                               <!--  Define  a  Coyote/JK2  AJP  1.3  Connector  on  port  8009  -->  
                           <Connector  className="org.apache.coyote.tomcat4.CoyoteConnector"  port="8009"    
                                 minProcessors="5"  maxProcessors="75"  enableLookups="true"  redirectPort="8443"    
                                 acceptCount="10"  debug="0"  connectionTimeout="20000"  useURIValidationHack="false"    
                                 protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>  
                           <!--  Define  an  AJP  1.3  Connector  on  port  8009  -->  
                           <!--  
                           <Connector  className="org.apache.ajp.tomcat4.Ajp13Connector"  port="8009"  minProcessors="5"    
                                 maxProcessors="75"  acceptCount="10"  debug="0"/>  
                           -->  
                   更改为:  
                               <!--  Define  a  Coyote/JK2  AJP  1.3  Connector  on  port  8009  -->  
                                   <!--  
                           <Connector  className="org.apache.coyote.tomcat4.CoyoteConnector"  port="8009"    
                                 minProcessors="5"  maxProcessors="75"  enableLookups="true"  redirectPort="8443"    
                                 acceptCount="10"  debug="0"  connectionTimeout="20000"  useURIValidationHack="false"    
                                 protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>  
                           -->  
                           <!--  Define  an  AJP  1.3  Connector  on  port  8009  -->  
                           <Connector  className="org.apache.ajp.tomcat4.Ajp13Connector"  port="8009"  minProcessors="5"    
                           maxProcessors="75"  acceptCount="10"  debug="0"/>  
                 并保存后关闭.  
                 小结:  兄弟一定都累了吧!好了,可以来一杯java,好好享受你的成果吧!
      

  3.   

    按楼上说的改成
    <!--  Define  a  Coyote/JK2  AJP  1.3  Connector  on  port  8009  -->  
                                   <!--  
                           <Connector  className="org.apache.coyote.tomcat4.CoyoteConnector"  port="8009"    
                                 minProcessors="5"  maxProcessors="75"  enableLookups="true"  redirectPort="8443"    
                                 acceptCount="10"  debug="0"  connectionTimeout="20000"  useURIValidationHack="false"    
                                 protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>  
                           -->  
                           <!--  Define  an  AJP  1.3  Connector  on  port  8009  -->  
                           <Connector  className="org.apache.ajp.tomcat4.Ajp13Connector"  port="8009"  minProcessors="5"    
                           maxProcessors="75"  acceptCount="10"  debug="0"/> 
    ——————--------------------------------------
    启动apache monitor->start 出现The request operation has failed!
    是不是只能把apache 和Tomcat分别开启,才能用了?
    还有如何让开启的Tomcat命令窗口在后台运行?老在任务栏上总觉得不爽。