Hi Rainier, >CommonGround Softworks/Phil McNamara schrieb: >> Hi Folks, >> Wondered if someone could help me with ideas on this? >> >> Have a configuration where a separate tomcat instance is installed (So >> apple can't break it :)). Apple's copy of tomcat provided with the >> machine in not running. The new Tomcat (5.5.7) plays fine on port 8080. >> i.e. >
>As mentioned by others: 5.5.7 is *very old*. Yes, that is to be fixed. Chuck made some good comments and pointed out some other options I was not aware of. I have a lot to learn. Very much appreciate the experience of everyone on this list. > >> http://localhost:8080/index.jsp >> >> We want to move to using apache 2.2 with mod_jk to hand off URI's >> appropriately to tomcat. >> Have worked through the material in >> http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html >> >> The mod_jk apache module provided with Apple's 10.5 server is enabled. >> >> Added listener to the engine element of server.xml >> >> <Listener className="org.apache.jk.config.ApacheConfig" >> modJK="/usr/libexec/apache2/mod_jk.so" /> > >Once you have your final configuration, this isn't needed any more. It's >only used to produce a simple basic mod_jk configuration. Tomcat doesn't >use the file by itself, instead the generated file needs to be put into >the httpd configuration. The generated file is only a very simple default. > Good to know. At least I got the mod_jk file to generate :) The generated file is referenced in the new include statement in httpd.conf >> The default workers properties file was looked over and edited.... >> >> I tweaked the default workers.properties. Here is some of the file >> content: >> >> # Normaly all you will need to do is un-comment and modify the first three snip.. > >These are only comments. yup, provided for info. You'll see more below... > >> I did this: >> >> >> workers.tomcat_home=/Applications/Qilan\ 3/Tomcat_Qilan >> #note below is the symlink recommended by Apple in technical QA1170 pgm >> workers.java_home=/Library/Java/Home > >Those two don't do anything useful any more. The auto-generation is very >outdated, it produces several non-functional configuration lines >(although they don't technically harm) > OK, I am guilty of following the directions in the workers.properties file :) >> >> but it was not clear to me what should be changed on worker.list. Left >> as is, to wit >> >> #------ DEFAULT worket list ------------------------------------------ >> #--------------------------------------------------------------------- >> # >> # >> # The workers that your plugins should create and work with >> # >> # Add 'inprocess' if you want JNI connector >> worker.list=ajp12, ajp13 > >The worker.list contains a comma-separated list of your worker names. >Worker names can be freely chosen (no special chars allowed). I would >suggest for a simple configuration remove "ajp12" and keep "ajp13". > will do. See below >If your worker is not defined in workers.properties (lines of the form >worker.ajp13.XXX=YYY), then it defaults to localhost port 8009 and >protocol ajp13. This might be fine in your case, but I would suggest to >do an explicit definition of the worker. > >> # , inprocess >> >> --- >> >> >> Added listener to the engine element of server.xml >> <Listener className="org.apache.jk.config.ApacheConfig" >> modJK="/usr/libexec/apache2/mod_jk.so" /> > >Once again? sorry, repeated myself > >> Restarted Tomcat and mod_jk.conf was generated along with the auto >> directory and so on. > >And so on? >What are the contents of the mod_jk.conf??? > mod_jk.conf file contents: ########## Auto generated on Wed Apr 09 18:55:01 EDT 2008########## <IfModule !mod_jk.c> LoadModule jk_module "libexec/mod_jk.so" </IfModule> <VirtualHost localhost> ServerName localhost JkMount /webdav ajp13 JkMount /webdav/* ajp13 JkMount /servlets-examples ajp13 JkMount /servlets-examples/* ajp13 JkMount /jsp-examples ajp13 JkMount /jsp-examples/* ajp13 JkMount /balancer ajp13 JkMount /balancer/* ajp13 JkMount /tomcat-docs ajp13 JkMount /tomcat-docs/* ajp13 JkMount /qilan ajp13 JkMount /qilan/* ajp13 JkMount /manager ajp13 JkMount /manager/* ajp13 </VirtualHost> >> Got the Include in Apache 2.2 httpd.conf pointing to mod_jk.conf squared >> away enough so that Apache starts OK. The include originally errored >> apache when I tried to backslash to escape the space between Qilan and 3. >> The below seems to work without an error >> >> Include "/Applications/Qilan 3/Tomcat_Qilan/conf/auto/mod_jk.conf" > >Yes, path with spaces ... OK, I wasn't sure, but as I mentioned, Apache seemed to be happy with the include > >> The mod_jk apache module provided with 10.5 server is enabled. > >Which version of mod_jk? > >> I port scanned the machine to check that there is a response from port >> 8009. >> This would appear to indicate that the ajp13 worker is playing correctly >> as defined in workers properties. >> >> I just can't seem to get the handoff to happen for URI's that should >> parse out to be >> handed to tomcat. >> All the other tutorial info I have located seems way too dated. >> >> Specifically what I see when I test http://localhost/index.jsp: >> >> Forbidden >> You don't have permission to access /index.jsp on this server. >> Additionally, a 403 Forbidden error was encountered while trying to use >> an ErrorDocument to handle the request. >> >> Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7l PHP/5.2.5 mod_jk/1.2.23 >> Server at localhost Port 80 > >Aha, so it's mod_jk 1.2.23. > >> I do see one console error when I start Apache: >> >> 4/8/08 10:35:36 PM org.apache.httpd[84287] [Tue Apr 08 22:35:36 2008] >> [warn] VirtualHost localhost:0 overlaps with VirtualHost localhost:0, the >> first has precedence, perhaps you need a NameVirtualHost directive >> >> I keep thinking my httpd.conf include is not working properly, but I ran >> out of ideas on how to modify it without an Apache error. >> >> Would appreciate any thoughts... > >Not without the contents of mod_jk.conf :( see above > >You can get a little more info by setting JkLogfLevel to debug and then >start httpd and do a single request, which should get forwarded to >Tomcat, but which does not work. > >Regards, > >Rainer I think I may have found part of the problem - Apple provides a "canned" Tomcat/JBoss environment to enable. I just spotted this in the apache2 httpd.conf ----- <IfModule mod_jk.c> JKWorkersFile /etc/apache2/workers.properties JKLogFile /var/log/apache2/mod_jk.log JKLogLevel error JKMount /*.jsp JBoss1 JKMount /servlet/* JBoss1 JKMount /examples/* JBoss1 </IfModule> ----- So I am not using JBoss, and our tomcat instance is located elsewhere so tweaked as below in httpd.conf (moved my previous include into the ifmodule) and restarted apache without error: ---- <IfModule mod_jk.c> JKWorkersFile "/Applications/Qilan 3/Tomcat_Qilan/conf/workers2.properties" JKLogFile /var/log/apache2/mod_jk.log JKLogLevel debug #JKMount /*.jsp JBoss1 #JKMount /servlet/* JBoss1 #JKMount /examples/* JBoss1 Include "/Applications/Qilan 3/Tomcat_Qilan/conf/auto/mod_jk.conf" </IfModule> ---- for reference (sorry for the extra bandwidth) this is the content of workers.properties with the edit you suggested: ---- # workers.properties - # # This file provides jk derived plugins with the needed information to # connect to the different tomcat workers. Note that the distributed # version of this file requires modification before it is usable by a # plugin. # # 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 value\something # # Normaly all you will need to do is un-comment and modify the first three # 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. # # # OPTIONS ( very important for jni mode ) # # 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=/var/tomcat3 workers.tomcat_home=/Applications/Qilan\ 3/Tomcat_Qilan # # workers.java_home should point to your Java installation. Normally # you should have a bin and lib directories beneath it. # #workers.java_home=/opt/IBMJava2-13 #note below is the symlink recommended by Apple in technical QA1170 pgm workers.java_home=/Library/Java/Home # # You should configure your environment slash... ps=\ on NT and / on UNIX # and maybe something different elsewhere. # ps=/ # #------ ADVANCED MODE ------------------------------------------------ #--------------------------------------------------------------------- # # #------ DEFAULT worket list ------------------------------------------ #--------------------------------------------------------------------- # # # The workers that your plugins should create and work with # # Add 'inprocess' if you want JNI connector worker.list= ajp13 # , inprocess # #------ 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)lib$(ps)tomcat.jar # # Setting the command line for tomcat. # Note: The cmd_line string may not contain spaces. # worker.inprocess.cmd_line=start # Not needed, but can be customized. #worker.inprocess.cmd_line=-config #worker.inprocess.cmd_line=$(workers.tomcat_home)$(ps)conf$(ps)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 # # Windows worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$( ps)jvm.dll # IBM JDK1.3 #worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$ (ps)libjvm.so # Unix - Sun VM or blackdown #worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps )classic$(ps)libjvm.so # # 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)logs$(ps)inprocess.stdou t worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stder r # # 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 # --- ------ I just tested this URL which did not work previously: http://localhost/qilan/Login.jsp and it works! So some progress has been made. Thank you Rainier! There are a slew of entries from debug in the mod_jk log. Here are the last few lines: [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/webdav/*=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/qilan/*=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/servlets-examples=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/jsp-examples=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/tomcat-docs=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/balancer=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/manager=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/webdav=ajp13' source 'JkMount' [Thu Apr 10 22:20:56 2008] [11971:0000] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/qilan=ajp13' source 'JkMount' --- If you want the entire debug from initializing, let me know? so my remaining challenge is figuring out how to properly map virtual domains to let mod_jk handle things properly. I tried one test with a virtual domain using the above URL string that worked on the server using localhost. Got this error in the browser: --- The requested URL /qilan/Login.jsp was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7l PHP/5.2.5 mod_jk/1.2.23 Server at www.dbmonline.net Port 80 --- So would the approach be to build the appropriate virtual host container in mod_jk.conf? Phil --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]