You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bob Bronson <rb...@yahoo.com> on 2005/04/26 21:13:57 UTC
Newbie Question: conext.xml
Hello everyone,
I'm very new to Tomcat so pardon me if this is an easy question.
I *have* read the relevant documentation (several times) and that
really just made matters worse. Sometimes the documentation seems a bit
incomplete. I've tried several things the documentation says should
work without success. Probably it's my lack of understanding.
As an aside, speaking of incomplete documentation, if you go to:
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html" you
will see there is a section entitled, "Automatic Application
Deployment". The third bullet point has a link to "Default Context".
This link does not work in the downloaded version of TC's documentation
although it works fine in the online version. I guess somebody forgot
something.
--------------
Let me explain what I want to do. I'm hoping someone could tell me
where I'm going wrong, in a polite way. :)
I'm trying to use TC 5.5.9 on Win 2k.
I want the "document base" directory (the <Context>'s "docBase") for my
default web application to be something other than ROOT. Please don't
ask, "why?", this is a simplification of a different but equivalent
problem.
When I start TC, CATALINA_BASE is set to "C:\MyConfigs". Here is what
the initial underlying directory structure looks like:
C:\MyConfig\
+-conf\
| +-context.xml
| +-server.xml
| +-web.xml
+-Sites\
| +-Test 1\
| | +-site\
| | | +-public_html\
| | | | +-ROOTXXX\
| | | | | +-index.html
I want my "docBase" to be "ROOTXXX" instead of "ROOT" (again, this is
an over-simplification but illustrates the problem).
Here is my server.xml from the "conf" directory above:
<Server port="10035" shutdown="SHUTDOWN" debug="0">
<Service name="Catalina">
<Connector port="80" />
<Engine name="ENGINE_1" defaultHost="localhost">
<Host name="localhost" appBase="Sites\Test 1\site\public_html" />
</Engine>
</Service>
</Server>
Here is my context.xml from the "conf" directory above:
<Context path="" docBase="ROOTXXX" />
In the TC docs for <Context>
(http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html),
it lists four bullet points that describe different places you can put
the "context.xml" file. I tried to follow each of these bullet points.
For each bullet point I first used a context file named "context.xml"
and then I tried "ROOT.xml". Here's what I saw:
Bullet 1: $CATALINA_HOME/conf/context.xml
-----------------------------------------
I placed "context.xml" in the "conf" directory. This is consistent with
the directory structure shown above. Tomcat seemed to start just fine
but when I browse to the default context (http://localhost) I get a
blank page. I then renamed "context.xml" to "ROOT.xml". This had no
effect. It still didn't work. According to the TC docs, it should work,
right?
Bullet 2:
$CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default
-------------------------------------------------------------------------
I placed "context.xml" in the directory "conf/ENGINE_1/localhost" and
renamed "context.xml" to "context.xml.default", as per the
documentation. This didn't work. I received a blank page again. I then
renamed "context.xml.default" to "ROOT.xml" and it worked! Hmmm, why
did it work? At least it's what I wanted. But why didn't
"context.xml.default" work? The TC docs say it should.
Bullet 3: $CATALINA_HOME/conf/[enginename]/[hostname]/
------------------------------------------------------
I didn't really understand this option since it didn't tell me what to
name the file, so I skipped this option.
Bullet 4: /META-INF/context.xml
-------------------------------
Another failure. I named the file "context.xml" and then I tried
"ROOT.xml". Neither worked, despite the TC documentation claims.
So, I'm kind of at a loss. I was successful with Bullet 2 but only when
I renamed "context.xml" to "ROOT.xml". None of the other attempts
worked, despite what the TC documentation said. Maybe there's another
doc I need to read. I don't know. It's just so confusing. Can someone
tell me why only #2 worked and then only when I named the file
ROOT.xml? Why didn't the Bullets 1 & 4 work and what does #3 even mean?
It's very frustrating.
Thanks for looking at this.
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Newbie Question: conext.xml
Posted by Bob Bronson <rb...@yahoo.com>.
Hello Fritz,
Thank you for the welcome. I have comments below....
----- Original Message -----
From: "Fritz Schneider" <Fr...@Peacham.HomeIP.net>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>; "'Bob
Bronson'" <rb...@yahoo.com>
Sent: Tuesday, April 26, 2005 3:22 PM
Subject: RE: Newbie Question: conext.xml
> Bob,
>
> Welcome, fellow newbie! I struggled with this one also. It turns out
> that
> the <context> element for a root directory MUST be nested inside the
> <host>
> element in server.xml. The relevant documentation reads:
I don't think this is right. First, here's another quote form the TC
docs:
"In addition to nesting Context elements inside a Host element, you can
also store them..." then there are 4 bullet points listed which I
refered to in my original posting.
The TC goes on to say: "Please note that for tomcat 5, unlike tomcat
4.x, it is NOT recommended to place <Context> elements directly in the
server.xml file."
So, it looks like it should NOT be in the server.xml. And, I was
actually able to get it working without putting it in server.xml.
> "You may define as many Context elements as you wish. Each such
> Context MUST
> have a unique context path, which is defined by the path attribute.
> In
> addition, you MUST define a Context with a context path equal to a
> zero-length string. This Context becomes the default web application
> for
> this virtual host, and is used to process all requests that do not
> match any
> other Context's context path."
yes, I know....this quote preceeds the four bullet points. I must have
read this a dozen times.
> Fritz
>
> -----Original Message-----
> From: Bob Bronson [mailto:rbronson1976@yahoo.com]
> Sent: Tuesday, April 26, 2005 12:14 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Newbie Question: conext.xml
>
> Hello everyone,
>
> [snip...]
> Let me explain what I want to do. I'm hoping someone could tell me
> where I'm going wrong, in a polite way. :)
>
> I'm trying to use TC 5.5.9 on Win 2k.
>
> I want the "document base" directory (the <Context>'s "docBase") for
> my
> default web application to be something other than ROOT. Please don't
> ask, "why?", this is a simplification of a different but equivalent
> problem.
>
> [snip...]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Newbie Question: conext.xml
Posted by Hassan Schroeder <ha...@webtuitive.com>.
Bob Bronson wrote:
> But using the "$CATALINA_HOME/conf/{engine}/{hostname}/ROOT.xml"
> approach is only one of 4 documented approaches (and the only approach I
> was able to get working).
>
> Why don't the other three work?
Well, I'm absolutely certain that this:
4: {appbase}/{docbase}/META-INF/context.xml
:: works just fine -- I use that approach sometimes.
Both of these:
1: $CATALINA_HOME/conf/context.xml
2: $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default
:: I've never tried, so I'd have to fiddle around a bit. But since
the other two work fine, and to me represent the optimal approach to
managing my webapps, I'm not overly motivated :-)
As always, YMMV!
--
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Newbie Question: conext.xml
Posted by Bob Bronson <rb...@yahoo.com>.
Hassan,
I know you are 100% correct...
But using the "$CATALINA_HOME/conf/{engine}/{hostname}/ROOT.xml"
approach is only one of 4 documented approaches (and the only approach
I was able to get working).
Why don't the other three work? And why can't I name the file
"context.xml", as the documentation indicates.
----- Original Message -----
From: "Hassan Schroeder" <ha...@webtuitive.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Cc: "'Bob Bronson'" <rb...@yahoo.com>
Sent: Tuesday, April 26, 2005 3:46 PM
Subject: Re: Newbie Question: conext.xml
> Fritz Schneider wrote:
>
>> Welcome, fellow newbie! I struggled with this one also. It turns out
>> that
>> the <context> element for a root directory MUST be nested inside the
>> <host>
>> element in server.xml.
>
> No, no, no. That's simply not true. I have multiple installations
> of 5.5.x systems running and not one has a Context element inside
> the server.xml.
>
> The dead simplest approach is to put ROOT.xml as
>
> $CATALINA_HOME/conf/{engine}/{hostname}/ROOT.xml
>
> Within that ROOT.xml file you can specify the docbase as ROOTXXXX
> or WhAtTheHeyEver or any appropriate arbitrary path...
>
> The name of the file is a Tomcat convention; the "docbase" *path*
> you specify is entirely up to you.
>
>
>> -----Original Message-----
>> From: Bob Bronson [mailto:rbronson1976@yahoo.com]
>
>> I want the "document base" directory (the <Context>'s "docBase") for
>> my default web application to be something other than ROOT. Please
>> don't ask, "why?", this is a simplification of a different but
>> equivalent problem.
>
>
> --
> Hassan Schroeder ----------------------------- hassan@webtuitive.com
> Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
>
> dream. code.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Newbie Question: conext.xml
Posted by Hassan Schroeder <ha...@webtuitive.com>.
Fritz Schneider wrote:
> Welcome, fellow newbie! I struggled with this one also. It turns out that
> the <context> element for a root directory MUST be nested inside the <host>
> element in server.xml.
No, no, no. That's simply not true. I have multiple installations
of 5.5.x systems running and not one has a Context element inside
the server.xml.
The dead simplest approach is to put ROOT.xml as
$CATALINA_HOME/conf/{engine}/{hostname}/ROOT.xml
Within that ROOT.xml file you can specify the docbase as ROOTXXXX
or WhAtTheHeyEver or any appropriate arbitrary path...
The name of the file is a Tomcat convention; the "docbase" *path*
you specify is entirely up to you.
> -----Original Message-----
> From: Bob Bronson [mailto:rbronson1976@yahoo.com]
> I want the "document base" directory (the <Context>'s "docBase") for my
> default web application to be something other than ROOT. Please don't
> ask, "why?", this is a simplification of a different but equivalent
> problem.
--
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: Newbie Question: conext.xml
Posted by Fritz Schneider <Fr...@Peacham.HomeIP.net>.
Bob,
Welcome, fellow newbie! I struggled with this one also. It turns out that
the <context> element for a root directory MUST be nested inside the <host>
element in server.xml. The relevant documentation reads:
"You may define as many Context elements as you wish. Each such Context MUST
have a unique context path, which is defined by the path attribute. In
addition, you MUST define a Context with a context path equal to a
zero-length string. This Context becomes the default web application for
this virtual host, and is used to process all requests that do not match any
other Context's context path."
Fritz
-----Original Message-----
From: Bob Bronson [mailto:rbronson1976@yahoo.com]
Sent: Tuesday, April 26, 2005 12:14 PM
To: tomcat-user@jakarta.apache.org
Subject: Newbie Question: conext.xml
Hello everyone,
[snip...]
Let me explain what I want to do. I'm hoping someone could tell me
where I'm going wrong, in a polite way. :)
I'm trying to use TC 5.5.9 on Win 2k.
I want the "document base" directory (the <Context>'s "docBase") for my
default web application to be something other than ROOT. Please don't
ask, "why?", this is a simplification of a different but equivalent
problem.
[snip...]
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org