Whew!  Maybe I can shed some light on this.

The whole Apache + JK + Tomcat process is a chain.  The chain has links.  If
any of the links are broken or messed up (misconfigured), the process
doesn't work.

So, there are three "macro" links to the chain.  Each "macro" link has a few
"micro" links.  Anyone of them that is wrong will break the whole thing.

The first macro link is Apache.  These things (micro links) need to be setup
in Apache:

- The mod_jk module has to be loaded with LoadModule.  Do this at the server
level with all of the other LoadModules
- somewhere in httpd.conf, whether for the entire server or a specific
virtual host, there needs to be a line that looks like this:

JkMount /someURL/* ajp13

"ajp13" can be anything, but let's keep things simple.  You might want to
have something like 

JkMount /someURL/*.jsp ajp13
JkMount /someURL/*.do ajp13
JkMount /servlet/* ajp13

Those lines tell Apache "for whatever host where these lines exist, attempt
to match the URL, and if there is a match, look in workers.properties for
information on the worker that is listed as second parameter"

"Whatever host" can mean ALL hosts that Apache knows about, or individual
hosts.  In httpd.conf, individual hosts are designated by the VirtualHost
container.  So, if you want to use http://www.myhost.com/someURL/test.jsp
and have that go to Tomcat, you MUST have a VirtualHost container that has
"ServerName www.myhost.com" OR Apache's global ServerName must be
www.myhost.com.  If you don't have this in httpd.conf, you won't get mod_jk
to work, as Apache will have no idea that anything with www.myhost.com
should go to mod_jk at all.

Note that www.myhost.com can be "localhost".  So, if you can see web pages
at http://www.myhost.com, you have Apache working.  What you have to
determine here is whether www.myhost.com is GLOBAL Apache, or a specific
Apache virtual host.  This will determine where you put your JkMount lines.
If GLOBAL Apache = www.myhost.com, and your JkMount lines are in a
VirtualHost container in httpd.conf for www.someotherhost.com,
www.myhost.com/test.jsp WILL NOT work.  The request will never get to
mod_jk.

The second macro link is workers.properties.  This file needs 4 lines in it,
that's all:

worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

Note that "ajp13" above MUST EQUAL the second parameter in your JkMount
lines.  If it doesn't, you won't get anything.  So if you have:

JkMount /someURL/* foo

Then you need to change "ajp13" in the four lines above to "foo".  My advice
is keep it ajp13.  

The "host" line in workers.properties is the host where Tomcat is running.

The third macro link is Tomcat.  For this to be working correctly there
needs to be a couple "minor" links setup:

- there needs to be a Host element in server.xml that matches the ServerName
in httpd.conf.  So if you are using http://www.myhost.com/test.jsp there
needs to be a Host element in server.xml with a name of www.myhost.com.

- there needs to be a Context configured to handle the path.  If your path
is myApp/test.jsp, there needs to be a Context setup for myApp.

- there needs to be a JK-compatible connector listening on 8009 (the same
port as the *.port line in workers.properties).  This JK-compatible
connector can either be CoyoteConnector or Ajp13Connector.  If this
connector isn't setup to listen on 8009 (or some other port), JK won't work.
Note that this port has nothing to do with 8080, Tomcat's default HTTP port.

My advice is to take each of the three "macro" links in the chain and verify
that each is setup exactly correct.  Then try your URL through mod_jk.
Maybe what would help everyone is if I (or someone else) came up with a
troubleshooting checklist.  The JK/JK2 stuff looks very confusing, but I
found that once I broke it down into the components, and worked with each
component separately before trying to get them to all work together at once,
it was much easier to diagnose what was going wrong.

HTH

John

-----Original Message-----
From: Denise Mangano [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 23, 2002 11:53 AM
To: 'Tomcat Users List'
Subject: RE: Mod_jk - won't execute jsp or servlets

Tomcat is up and running - I can view and execute examples by using :8080.
If the port that Tomcat is listening on is set by workers.properties, then
that would be port 8009.  Where Apache is expecting it to listen on I am not
sure.  The email I sent was correct - the uncommented ports are those that
were listed.  The only difference between the two is the connection Timeout
settings... ( I posted the correct server.xml file - the second email
contains the correct one).

Thanks.

Denise Mangano
Help Desk Analyst
Complus Data Innovations, Inc.
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.419 / Virus Database: 235 - Release Date: 11/13/2002
 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to