You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by FastGorilla <do...@gmail.com> on 2007/09/16 19:07:47 UTC

Changing ROOT context

Hi,

I have a problem with changing the default ROOT context to something else
(myroot).


#### Specs ####
-Windows Vista
-Tomcat 6.0.14 (latest)


#### Problem ####
I want the following directory to be the ROOT context:
$CATALINA_HOME/webapps/myroot

So that http://localhost/test.txt is directly mapped to
$CATALINA_HOME/webapps/myroot/test.txt

And I do not want any other directory than myroot to exist in
$CATALINA_HOME/webapps


#### What I have tried ####
Modifing the host-tag in server.xml to:

<Host name="localhost"  appBase="webapps"
  <Context docBase="myroot" path=""></Context>
</Host>

, solves the problem. But the Tomcat 6 docs[1] specify that it is NOT
recommended to put context-tags in server.xml. So I want to put the
context-tags elsewhere.

I tried to put the context-tag (above) in the file
$CATALINA_HOME/conf/catalina/localhost/ROOT.xml to make myroot the default
web application (as is told in [1]). But then I get the error:

16-sep-2007 15:31:34 org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase D:\Apache Software
Foundation\apache-tomcat-6.0.14\webapps\myroot inside the host appBase has
been specified, and will be ignored
16-sep-2007 15:31:34 org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\Apache Software
Foundation\apache-tomcat-6.0.14\webapps\ROOT does not exist or is not a
readable directory

In the webbrowser, http://localhost:8080/test.txt won't work, but
http://localhost:8080/myroot/test.txt will...

Somehow it keeps looking for the ROOT dir.

How can I change ROOT to myroot, and let http://localhost:8080/test.txt be
the url?



#### Resources ####
[1] http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
-- 
View this message in context: http://www.nabble.com/Changing-ROOT-context-tf4461140.html#a12721557
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Changing ROOT context

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: StrongGorilla [mailto:lowbass@gmail.com] 
> Subject: Re: Changing ROOT context
> 
> I downloaded the Servlet Spec 2.5 pdf, but it says nothing 
> about "ROOT".

Correct; the name ROOT is Tomcat's way of denoting the default context,
replacing the older path="" mechanism.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Changing ROOT context

Posted by StrongGorilla <lo...@gmail.com>.
Hi David,

I downloaded the Servlet Spec 2.5 pdf, but it says nothing about "ROOT".

http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html




David Smith-2 wrote:
> 
> Have you thought about renaming $CATALINA_HOME/webapps/myroot to 
> $CATALINA_HOME/webapps/ROOT ?  The servlet spec is very clear that the 
> ROOT webapp is a special webapp accepting all requests that do not match 
> any other web application context.
> 
> --David
> 
> FastGorilla wrote:
>> Hi,
>>
>> I have a problem with changing the default ROOT context to something else
>> (myroot).
>>
>>
>> #### Specs ####
>> -Windows Vista
>> -Tomcat 6.0.14 (latest)
>>
>>
>> #### Problem ####
>> I want the following directory to be the ROOT context:
>> $CATALINA_HOME/webapps/myroot
>>
>> So that http://localhost/test.txt is directly mapped to
>> $CATALINA_HOME/webapps/myroot/test.txt
>>
>> And I do not want any other directory than myroot to exist in
>> $CATALINA_HOME/webapps
>>
>>
>> #### What I have tried ####
>> Modifing the host-tag in server.xml to:
>>
>> <Host name="localhost"  appBase="webapps"
>>   <Context docBase="myroot" path=""></Context>
>> </Host>
>>
>> , solves the problem. But the Tomcat 6 docs[1] specify that it is NOT
>> recommended to put context-tags in server.xml. So I want to put the
>> context-tags elsewhere.
>>
>> I tried to put the context-tag (above) in the file
>> $CATALINA_HOME/conf/catalina/localhost/ROOT.xml to make myroot the
>> default
>> web application (as is told in [1]). But then I get the error:
>>
>> 16-sep-2007 15:31:34 org.apache.catalina.startup.HostConfig
>> deployDescriptor
>> WARNING: A docBase D:\Apache Software
>> Foundation\apache-tomcat-6.0.14\webapps\myroot inside the host appBase
>> has
>> been specified, and will be ignored
>> 16-sep-2007 15:31:34 org.apache.catalina.core.StandardContext
>> resourcesStart
>> SEVERE: Error starting static Resources
>> java.lang.IllegalArgumentException: Document base D:\Apache Software
>> Foundation\apache-tomcat-6.0.14\webapps\ROOT does not exist or is not a
>> readable directory
>>
>> In the webbrowser, http://localhost:8080/test.txt won't work, but
>> http://localhost:8080/myroot/test.txt will...
>>
>> Somehow it keeps looking for the ROOT dir.
>>
>> How can I change ROOT to myroot, and let http://localhost:8080/test.txt
>> be
>> the url?
>>
>>
>>
>> #### Resources ####
>> [1] http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>>   
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Changing-ROOT-context-tf4461140.html#a12724882
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Changing ROOT context

Posted by David Smith <dn...@cornell.edu>.
Have you thought about renaming $CATALINA_HOME/webapps/myroot to 
$CATALINA_HOME/webapps/ROOT ?  The servlet spec is very clear that the 
ROOT webapp is a special webapp accepting all requests that do not match 
any other web application context.

--David

FastGorilla wrote:
> Hi,
>
> I have a problem with changing the default ROOT context to something else
> (myroot).
>
>
> #### Specs ####
> -Windows Vista
> -Tomcat 6.0.14 (latest)
>
>
> #### Problem ####
> I want the following directory to be the ROOT context:
> $CATALINA_HOME/webapps/myroot
>
> So that http://localhost/test.txt is directly mapped to
> $CATALINA_HOME/webapps/myroot/test.txt
>
> And I do not want any other directory than myroot to exist in
> $CATALINA_HOME/webapps
>
>
> #### What I have tried ####
> Modifing the host-tag in server.xml to:
>
> <Host name="localhost"  appBase="webapps"
>   <Context docBase="myroot" path=""></Context>
> </Host>
>
> , solves the problem. But the Tomcat 6 docs[1] specify that it is NOT
> recommended to put context-tags in server.xml. So I want to put the
> context-tags elsewhere.
>
> I tried to put the context-tag (above) in the file
> $CATALINA_HOME/conf/catalina/localhost/ROOT.xml to make myroot the default
> web application (as is told in [1]). But then I get the error:
>
> 16-sep-2007 15:31:34 org.apache.catalina.startup.HostConfig deployDescriptor
> WARNING: A docBase D:\Apache Software
> Foundation\apache-tomcat-6.0.14\webapps\myroot inside the host appBase has
> been specified, and will be ignored
> 16-sep-2007 15:31:34 org.apache.catalina.core.StandardContext resourcesStart
> SEVERE: Error starting static Resources
> java.lang.IllegalArgumentException: Document base D:\Apache Software
> Foundation\apache-tomcat-6.0.14\webapps\ROOT does not exist or is not a
> readable directory
>
> In the webbrowser, http://localhost:8080/test.txt won't work, but
> http://localhost:8080/myroot/test.txt will...
>
> Somehow it keeps looking for the ROOT dir.
>
> How can I change ROOT to myroot, and let http://localhost:8080/test.txt be
> the url?
>
>
>
> #### Resources ####
> [1] http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Changing ROOT context

Posted by StrongGorilla <lo...@gmail.com>.
Yes, I have tried $CATALINA_HOME/conf/catalina/localhost/ROOT.xml



Filip Hanik - Dev Lists wrote:
> 
> have you tried to create a file called ROOT.xml in 
> conf/Catalina/localhost containing your <Context> tag?
> (of course, remove webapps/ROOT first)
> Filip
> 
> FastGorilla wrote:
>> Hi,
>>
>> I have a problem with changing the default ROOT context to something else
>> (myroot).
>>
>>
>> #### Specs ####
>> -Windows Vista
>> -Tomcat 6.0.14 (latest)
>>
>>
>> #### Problem ####
>> I want the following directory to be the ROOT context:
>> $CATALINA_HOME/webapps/myroot
>>
>> So that http://localhost/test.txt is directly mapped to
>> $CATALINA_HOME/webapps/myroot/test.txt
>>
>> And I do not want any other directory than myroot to exist in
>> $CATALINA_HOME/webapps
>>
>>
>> #### What I have tried ####
>> Modifing the host-tag in server.xml to:
>>
>> <Host name="localhost"  appBase="webapps"
>>   <Context docBase="myroot" path=""></Context>
>> </Host>
>>
>> , solves the problem. But the Tomcat 6 docs[1] specify that it is NOT
>> recommended to put context-tags in server.xml. So I want to put the
>> context-tags elsewhere.
>>
>> I tried to put the context-tag (above) in the file
>> $CATALINA_HOME/conf/catalina/localhost/ROOT.xml to make myroot the
>> default
>> web application (as is told in [1]). But then I get the error:
>>
>> 16-sep-2007 15:31:34 org.apache.catalina.startup.HostConfig
>> deployDescriptor
>> WARNING: A docBase D:\Apache Software
>> Foundation\apache-tomcat-6.0.14\webapps\myroot inside the host appBase
>> has
>> been specified, and will be ignored
>> 16-sep-2007 15:31:34 org.apache.catalina.core.StandardContext
>> resourcesStart
>> SEVERE: Error starting static Resources
>> java.lang.IllegalArgumentException: Document base D:\Apache Software
>> Foundation\apache-tomcat-6.0.14\webapps\ROOT does not exist or is not a
>> readable directory
>>
>> In the webbrowser, http://localhost:8080/test.txt won't work, but
>> http://localhost:8080/myroot/test.txt will...
>>
>> Somehow it keeps looking for the ROOT dir.
>>
>> How can I change ROOT to myroot, and let http://localhost:8080/test.txt
>> be
>> the url?
>>
>>
>>
>> #### Resources ####
>> [1] http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>>   
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Changing-ROOT-context-tf4461140.html#a12724720
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Changing ROOT context

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
have you tried to create a file called ROOT.xml in 
conf/Catalina/localhost containing your <Context> tag?
(of course, remove webapps/ROOT first)
Filip

FastGorilla wrote:
> Hi,
>
> I have a problem with changing the default ROOT context to something else
> (myroot).
>
>
> #### Specs ####
> -Windows Vista
> -Tomcat 6.0.14 (latest)
>
>
> #### Problem ####
> I want the following directory to be the ROOT context:
> $CATALINA_HOME/webapps/myroot
>
> So that http://localhost/test.txt is directly mapped to
> $CATALINA_HOME/webapps/myroot/test.txt
>
> And I do not want any other directory than myroot to exist in
> $CATALINA_HOME/webapps
>
>
> #### What I have tried ####
> Modifing the host-tag in server.xml to:
>
> <Host name="localhost"  appBase="webapps"
>   <Context docBase="myroot" path=""></Context>
> </Host>
>
> , solves the problem. But the Tomcat 6 docs[1] specify that it is NOT
> recommended to put context-tags in server.xml. So I want to put the
> context-tags elsewhere.
>
> I tried to put the context-tag (above) in the file
> $CATALINA_HOME/conf/catalina/localhost/ROOT.xml to make myroot the default
> web application (as is told in [1]). But then I get the error:
>
> 16-sep-2007 15:31:34 org.apache.catalina.startup.HostConfig deployDescriptor
> WARNING: A docBase D:\Apache Software
> Foundation\apache-tomcat-6.0.14\webapps\myroot inside the host appBase has
> been specified, and will be ignored
> 16-sep-2007 15:31:34 org.apache.catalina.core.StandardContext resourcesStart
> SEVERE: Error starting static Resources
> java.lang.IllegalArgumentException: Document base D:\Apache Software
> Foundation\apache-tomcat-6.0.14\webapps\ROOT does not exist or is not a
> readable directory
>
> In the webbrowser, http://localhost:8080/test.txt won't work, but
> http://localhost:8080/myroot/test.txt will...
>
> Somehow it keeps looking for the ROOT dir.
>
> How can I change ROOT to myroot, and let http://localhost:8080/test.txt be
> the url?
>
>
>
> #### Resources ####
> [1] http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Changing ROOT context

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: StrongGorilla [mailto:lowbass@gmail.com] 
> Subject: RE: Changing ROOT context
> 
> Strange that is it possible when I define to context
> in server.xml, but not possible when I define it in
> conf/catalina/localhost/ROOT.xml

I suspect that the webapp was deployed twice, once as the default and
once as myroot.  The capability of specifying <Context> elements in
server.xml is there largely just for compatibility with older levels,
and really shouldn't be used.

Note that if you keep your webapp outside of the <Host> appBase
directory, you can use the conf/Catalina/[host]/ROOT.xml mechanism, with
the docBase attribute pointing to the location of the webapp, stored
under any arbitrary name you'd like.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Changing ROOT context

Posted by StrongGorilla <lo...@gmail.com>.
Strange that is it possible when I define to context in server.xml, but not
possible when I define it in conf/catalina/localhost/ROOT.xml



Caldarale, Charles R wrote:
> 
>> From: FastGorilla [mailto:dodmem@gmail.com] 
>> Subject: Changing ROOT context
>> 
>> How can I change ROOT to myroot, and let 
>> http://localhost:8080/test.txt be the url?
> 
> You can't - the default context must be named ROOT.  Just rename your
> webapp, as others have suggested.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Changing-ROOT-context-tf4461140.html#a12724736
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Changing ROOT context

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: FastGorilla [mailto:dodmem@gmail.com] 
> Subject: Changing ROOT context
> 
> How can I change ROOT to myroot, and let 
> http://localhost:8080/test.txt be the url?

You can't - the default context must be named ROOT.  Just rename your
webapp, as others have suggested.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Changing ROOT context

Posted by Waseem Azhar <wa...@gmail.com>.
Sorry I overlooked some previous conversation.

On 9/18/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
>
> > From: Waseem Azhar [mailto:waseemzhr@gmail.com]
> > Subject: Re: Changing ROOT context
> >
> > Just open your server.xml  add line <Context path=""
> > docBase="your-app-name" debug="99" reloadable="true"/>
>
> Please read the doc before responding.  Putting <Context> elements in
> server.xml has been strongly discouraged for several years.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: Changing ROOT context

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Waseem Azhar [mailto:waseemzhr@gmail.com] 
> Subject: Re: Changing ROOT context
> 
> Just open your server.xml  add line <Context path="" 
> docBase="your-app-name" debug="99" reloadable="true"/>

Please read the doc before responding.  Putting <Context> elements in
server.xml has been strongly discouraged for several years.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Changing ROOT context

Posted by Waseem Azhar <wa...@gmail.com>.
Just open your server.xml  add line <Context path="" docBase="your-app-name"
debug="99" reloadable="true"/> in the next line of your host configuration

example :

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="" docBase="your-app-name" debug="99" reloadable="true"/>

Thats it! you would found your application the default app , you can access
it as http://your-host-name/

Cheers.
-Azhar



On 9/16/07, FastGorilla <do...@gmail.com> wrote:
>
>
> Hi,
>
> I have a problem with changing the default ROOT context to something else
> (myroot).
>
>
> #### Specs ####
> -Windows Vista
> -Tomcat 6.0.14 (latest)
>
>
> #### Problem ####
> I want the following directory to be the ROOT context:
> $CATALINA_HOME/webapps/myroot
>
> So that http://localhost/test.txt is directly mapped to
> $CATALINA_HOME/webapps/myroot/test.txt
>
> And I do not want any other directory than myroot to exist in
> $CATALINA_HOME/webapps
>
>
> #### What I have tried ####
> Modifing the host-tag in server.xml to:
>
> <Host name="localhost"  appBase="webapps"
> <Context docBase="myroot" path=""></Context>
> </Host>
>
> , solves the problem. But the Tomcat 6 docs[1] specify that it is NOT
> recommended to put context-tags in server.xml. So I want to put the
> context-tags elsewhere.
>
> I tried to put the context-tag (above) in the file
> $CATALINA_HOME/conf/catalina/localhost/ROOT.xml to make myroot the default
> web application (as is told in [1]). But then I get the error:
>
> 16-sep-2007 15:31:34 org.apache.catalina.startup.HostConfigdeployDescriptor
> WARNING: A docBase D:\Apache Software
> Foundation\apache-tomcat-6.0.14\webapps\myroot inside the host appBase has
> been specified, and will be ignored
> 16-sep-2007 15:31:34 org.apache.catalina.core.StandardContextresourcesStart
> SEVERE: Error starting static Resources
> java.lang.IllegalArgumentException: Document base D:\Apache Software
> Foundation\apache-tomcat-6.0.14\webapps\ROOT does not exist or is not a
> readable directory
>
> In the webbrowser, http://localhost:8080/test.txt won't work, but
> http://localhost:8080/myroot/test.txt will...
>
> Somehow it keeps looking for the ROOT dir.
>
> How can I change ROOT to myroot, and let http://localhost:8080/test.txt be
> the url?
>
>
>
> #### Resources ####
> [1] http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
> --
> View this message in context:
> http://www.nabble.com/Changing-ROOT-context-tf4461140.html#a12721557
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>