tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Multiple websites in tomcat
Date Sun, 20 Jul 2008 13:44:42 GMT
The good news is that you will learn more by encountering problems and 
solving them, than if everything worked correctly on the first pass.

Ravi Sharma wrote:

> Alias /ex /usr/java/tomcat-5.5/webapps/servlets-examples
> JkMount /ex/servlet/* testWorker

I think that the two lines above conflict with eachother :

First you are telling Apache that if it sees "/ex" in a URI, it should 
translate it to "/usr/java/tomcat-5.5/webapps/servlets-examples".
Then you are telling Apache that if it sees a URI like "/ex/servlet/*", 
it should pass it to mod_jk (which will pass it to Tomcat).

Here is my guess as to what happens, step by step :

You send the following request to Apache :

Because of the "Alias", Apache will first translate this to the file 

Then Apache will try to find a "handler" for that location.
Because mod_jk is installed, Apache will ask mod_jk if it is interested 
in this URI.

mod_jk will say no, because the above translated URI does not match 
"/ex/servlet/*" in the JkMount.  So mod_jk will return "DECLINED" to Apache.

Then Apache will ask other possible handlers, and if nobody else wants 
this URI, then Apache will select its own default handler (the one which 
just returns local files).

This default handler will try to find the file
and will not find it. So it will return an error.

The point is that an "Alias" happens earlier in the cycle of processing 
the request (the "URI translation" step), and the "content generation" 
step happens later.  mod_jk (and Tomcat) are involved in the 
"content-generation" phase.  But by the time mod_jk is getting asked if 
it wants to generate the content, the URI is already tanslated, and 
mod_jk does not recognise it.

In short, for a test of the above, comment out the "Alias" line, restart 
Apache, and try again the URL

Of course, with the above change, your first URL
will probably not work anymore, but that is normal and we will see that 

For a bit more more information on the order in which the various 
request processing steps happen in Apache, read through this :
For the same with pictures, try this :


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message