tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re: trying to understand contexts
Date Sat, 24 Aug 2002 02:43:17 GMT
Hi Craig,

First, one thing to note is that your contexts don't actually have to be 
registered in the server.xml if they are deployed from the 
$TOMCAT_HOME/webapps directory.  A context will be created automatically by 
Tomcat.  The only reason why you might want to add a <Context ...> element 
for a particular context is to add some non-default configuration info.

Now we get to the ROOT context.  You will notice in Tomcat's webapps 
directory, there is a directory named "ROOT".  That name is a special case 
for Tomcat.  Any context named ROOT (case sensitive, I believe) will be the 
default context served off of the path http://localhost:8080/

What you can do is place your own webapp inside the ROOT directory and 
rename the one that came with Tomcat.  Also, if you want to provide some 
extra non-default configuration info for the ROOT context, you can add the 

<Context path="" docBase="ROOT" debug="0">

Notice the the "path" attribute value is "", not "/".

Also, note that your docBase can be of any name as long as you have a 
defined <Context ...> element pointing to it and have the path as 
"".  Actually, I'm not sure what would happen if you had that and then had 
a ROOT directory in the webapps directory without any <Context ...> element 
defined for it?  You'd have to test that out.

Anyway, that should clear up some of the mystery.  Write back if you have 
more questions.


At 09:34 PM 8/23/2002 -0400, you wrote:

>hi there,
>i am trying to wade through the configuration of tomcat now, and i'm
>terribly confused about a few things.  pretty much all of the time when
>i've created sites before, i've simply had a servlet process certain
>filetype extensions or such, without much regard for what directory
>things are located in.  occasionally, a servlet would be invoked
>directly with a url something like /servlet/XXX.
>with tomcat however, it seems that directories are king.  everything
>needs to be in a directory, and its frustrating.  i just spent a great
>deal of time trying to make a context with a path of "/" work, but to no
>avail.  the documentation says that i MUST (emphasis in the docs) have a
>context with a blank path, but the example server.xml file has it
>commented out.  whenever i tried to use the context with path="/", i
>would simply get 'no context available' error messages.
>anyway, i'm trying to set things up so that everything off of the root
>directory are processed by my servlet engine, based on the file
>extension, much like jsp files work.  the problems are:
>1) using path="/" just doesn't work.  is this a bug?  if not, why is
>this not a valid context.
>2) using path="" seems to invoke my servlet ok, but then for some reason
>the 'reload' option in the application manager disappears. this means i
>need to restart the server every time something changes, not exactly the
>quickest development path.
>3) just go with the flow and make my site(s) oriented around a directory
>off of the main directory.  i guess this would be the simplest, but it
>just seems strange.
>so, any pointers that could help me understand whats going on would be
>helpful, i guess i'm just too used to the simple old jserv way of doing
>things, where you had files be processed anywhere (if the extension
>matched), and /servlet/XXX as the way to invoke other servlets.  is this
>style mimicable in tomcat?
>btw, this is 4.1.9 (beta).
>     CraigL->Thx();
>     Be Developer ID: 5852
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message