tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Configuring which Servlet is invoked
Date Mon, 11 Oct 2010 10:31:57 GMT
Christopher Dodunski wrote:
> Hi,
> Thanks, but I'm not quite clear on how to direct Tomcat to call the ROOT
> application for a given domain.  I added the bottom <Host> element to
> server.xml, but it doesn't appear to work correctly.
> <Engine name="Catalina" defaultHost="localhost">
>   <Host name="localhost"  appBase="webapps" unpackWARs="true"
> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
>   </Host>
>   <Host name="" appBase="webapps/ROOT" />
> </Engine>
> Previously, the URL called up
> webapps/christopher, when it should instead have been handled by Apache
> Roller running with ROOT context.  Now that I have added the above
> directive, Tomcat reports "The requested resource () is not available".
> The URL is handled by Roller, as intended,
> because there is no competing application at webapps/bread.
It is difficult to respond clearly to your questions, because they seem to be based on the

wrong premises, and/or they are confusing as to what you are really trying to achieve.
We also have no idea what the ROLLER application is, and how itself needs to be set up.

But here are some basic principles :

1) this line :
  <Engine name="Catalina" defaultHost="localhost">
indicates which one of your <Host> below, is the default host.
The default Host is the one which will handle any request which arrives at this server, 
and for which the hostname does not match one of the other <Host> tags.
In you case thus, this
<Host name="localhost"..
is the default Host.

2) each separate Host should have a separate "appBase", not overlapping the others.
So, having one Host with appBase="webapps", and another Host with appBase="webapps/xxxx" 
is a nono, you should not do that.
Create another directory, for example (tomcat_dir)/webapps-blog, and use that one to put 
the applications related to your host, like
<Host name="" appBase="webapps-blog" />
(You can also define this directory totally outside the hierarchy of the main Tomcat, like

at /var/websites/, and then use
<Host name="" appBase="/var/websites/" />

3) within each "applications base" (appBase), each application will correspond to a 
directory, with the same name as the application.
So for example, under (tomcat_dir)/webapps/, you can have one application called "app1" 
and another called "app2", for a structure like this

4) To call any of these applications, you will use a URL like :

5) the special name "ROOT" is reserved for the "default application" within a Host.
    That is the application which users would get if they simply entered

So, to modify the structure given above so that there would be, in addition to app1 anbd 
app2, a default application, you would have :

   a) a file structure like this :
and users could ask for :

    http://host-name/      (to get the default application)
    http://host-name/app1  (to get the app1 application)
    http://host-name/app2  (to get the app2 application)

Does this clarify things ?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message