OK, as it says in the tomcat connector docs, you need two Listener directives in server.xml. You need a global Listener directive for things like "LoadModule" and "JkLogFile". You also need a Host level Listener directive for things that are hostname specific (like JkMount).
Taken straight from the docs: Server-level Listener: <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" /> Host-level Listener: <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" /> I would add the forwardAll directive to the Host-level Listener, as the default is "true" and that means tomcat will handle all requests, not just servlet and JSP requests, and that makes Apache redundant. So your Host-level Listener would look like this: <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" forwardAll="false" /> That is the exact Listener directive that I use. I don't use a Server-level Listener directive. I just got done setting up apache 1.3 and tomcat 4.0.4 on a Linux box (Windows isn't that much different except for pathnames). I only made 2 changes to my server.xml file: 1) I changed the name parameter in my Host directive to match my server name (www.xyz.com). You could probably leave it at localhost. 2) I added the Host-level Listener directive as explained above. Here are the lines from my httpd.conf file (at the very end and note that I am using a Linux system, your mod_jk file is mod_jk.dll, I think): # Configure mod_jk # LoadModule jk_module libexec/mod_jk.so JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties JkLogFile /usr/local/apache/logs/mod_jk.log JkLogLevel info # include the mod_jk.conf file generated by tomcat Include /usr/local/tomcat/conf/auto/mod_jk.conf That's it. That's all I did (assuming you have apache working on its own, and tomcat working on its own). Note that you will need to start tomcat BEFORE starting apache, as tomcat needs to generate the mod_jk.conf file in CATALINA_HOME/conf/auto. I don't think there are major differences between doing this with apache 2 vs. apache 1.3, so I hope this helps. John Turner [EMAIL PROTECTED] -----Original Message----- From: Heligon Sandra [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 11:17 AM To: 'Tomcat Users List' Subject: RE: Help Apache2.0 with Tomcat4 (mod_jk or mod_jk2 or mod_webapp ?) Sorry I am new with Apache-Tomcat and I find the configuration little hard. I followed the previous mail of nikolas to change server.xml, httpd.conf, workers.properties files. To start with a basic Tomcat configuration. My server.xml file is the following: <Server port="8005" shutdown="SHUTDOWN" debug="0"> <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" modJk= "c:/Apache2/modules"/> <!-- Define an Apache-Connector Service --> <Service name="Tomcat-Apache"> <!-- 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"/> </Service> </Server> Is it a good minimum configuration ? I have placed a file workers.properties in the conf/jk directory. and the following mod_jk.conf file as been created <IfModule !mod_jk.c> LoadModule jk_module c:/Apache2/modules </IfModule> JkWorkersFile "c:/jbuilder5/jakarta-tomcat-4.0.4/conf/jk/workers.properties" JkLogFile "c:/jbuilder5/jakarta-tomcat-4.0.4/logs/mod_jk.log" JkLogLevel emerg But I have a java.lnag.NullPointerException when the service(Tomcat) is launched. I read that we must keep the Ajp13 connector definition if we use Ajp12, is it true ? What element allows in the server.xml file to automcatically generate JkMount? Is it the <context> element and <listener> in the context ? Very hard.................... Thanks a lot. -----Original Message----- From: Turner, John [mailto:[EMAIL PROTECTED]] Sent: 31 July 2002 16:06 To: 'Tomcat Users List' Subject: RE: Help Apache2.0 with Tomcat4 (mod_jk or mod_jk2 or mod_webapp ?) Hold on!!! Slow down. You are jumping all over the place. Take things one at a time and you will get this working. First: do the tomcat examples work? Do you get successful results at this URL: http://localhost:8080/examples ? Second: does Apache work? Do you get a successful page when you go to http://localhost ? The best way for us to help you is for you to explaine 1) what is currently working, 2) what is currently not working, and 3) what you have done to try and resolve any errors or issues. - you definitely should have a Host entry in server.xml with a name of "localhost" - the Listener entry you listed is for causing tomcat to generate the part of apache's httpd.conf that will send servlet and JSP requests to tomcat. You can either configure everything manually, or you can configure server.xml, and when tomcat starts, it will create a file with apache configuration directives in it. If you do it that way, all you have to do is include the file that tomcat creates in your apache config file with an Include directive. You also have to remember to start tomcat first, since the config file it generates for apache is generated every time. If you configure everything manually, you do not need this. - the closing tag for directives in server.xml is "/>". This is shorthand. If you open a tag with "<Listener" you close it with "/>", not "</Listener>". - "best solution" is relative. Only you can decide this, we can't decide it for you. Every situation is different. The HOWTO at www.cnr.berkeley.edu sets up a working server configuration. All due respect to you, but that would be the "best solution" as a starting point, after which you could change things to suit your situation as needed. John Turner [EMAIL PROTECTED] -----Original Message----- From: Heligon Sandra [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 9:53 AM To: 'Tomcat Users List' Subject: RE: Help Apache2.0 with Tomcat4 (mod_jk or mod_jk2 or mod_webapp ?) Before posting the message I read the http://www.acg-gmbh.de/mod_jk/ but I thought that the mod_jk.dll was not good in relation to the notes. It was an error from me. But It doesn't work. I can start Apache an Tomcat but I can not run my web applications. When I start Tomcat no web application is deployed. I have a question why the AddModule expression is not added to the httpdconf ? is this expression present in the mod_jk.conf-auto ? The link http://www.cnr.berkeley.edu/~salazar/apache_tomcat.html is very interesting, but the notion of <Host name="localhost" debug="0" appbase="webapps"> is noted and I don't have any such element in the server.xml file. I think that that the <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" /> is optional, isn't it ? If the web applications are automatically deployed we don't have context elements in the server.xml. What is the best solution ? I added only the <Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"> element but I don't know if I must add a closed tag </Listener> and where ? With this line I can not start Tomcat and the log gives no help. Can somebody send me a server.xml file that allow to enable apache auto configuration ? Thanks a lot. -----Original Message----- From: Turner, John [mailto:[EMAIL PROTECTED]] Sent: 31 July 2002 15:06 To: 'Tomcat Users List' Subject: RE: Help Apache2.0 with Tomcat4 (mod_jk or mod_jk2 or mod_webapp ?) My advice is to use mod_jk. Mod_jk2 is still new, and there are some issues with mod_webapp that prevent it from being ready for production in my opinion. These may help: http://www.acg-gmbh.de/mod_jk/ (you need the mod_jk.dll file from here) http://www.cnr.berkeley.edu/~salazar/apache_tomcat.html http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/ajp.html John Turner [EMAIL PROTECTED] -----Original Message----- From: Heligon Sandra [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 8:54 AM To: '[EMAIL PROTECTED]' Subject: Help Apache2.0 with Tomcat4 (mod_jk or mod_jk2 or mod_webapp ?) Hi, I am working on a web application. I used the default Tomcat4.0.4 configuration until now. (standalone mode execution). I would like to use Apache and Tomcat together but I don't understand what I must do. The configuration is very hard, there are a lot of elements httpd.conf, server.xml, mod_jk.dll or mod_jk2.dll or mod_webapp.dll... I don't know what module I must use ? My environment is the following: - Windows 2000 - Tomcat4.0.4 (I believe that the new version 4.1 is better with JSP but it implies new configuration yet) - Apache2.0.39 (it's the last stable version, I believe) I don't know the new features of mod_jk2 vs mod_jk vs mod_webapp. Do I have to create a <context> element for each web application with mod_jk or can each application deploy automatically ? If I want to use mod_jk2, how can I get the mod_jk.dll associated to Tomcat4.0.4 and Apache2.0.39 ? I read that it is possible to enable Apache -Tomcat automatically with include the file mod_jk.conf-auto in the httpd.conf. How is the mod_jk.conf-auto file generated ? Thanks a lot in advance. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
