You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jean-Paul Le Fèvre <Le...@fonteny.org> on 2004/09/18 11:38:53 UTC

Renaming the ROOT directory ?

I don't understand how to specify a default context.
I'm currently working with tomcat-5.0.27 and my server
is supporting 3 virtual hosts.

In the config file (server.xml) I declare a default context
with :
     <Context path = "" docBase = "my_app" ...

The directory 'my_app' is available in the 'webapps' directory.
Depending on the case it is directly copied or extracted from a
war file.
However when the application is deployed a 'ROOT' directory is automatically
created. Its content duplicates the one in 'my_app'.

When I update something in 'my_app' the copy in 'ROOT' is not synchronized
and the 2 directories become different.

The problem is that tomcat is actually serving the content of 'ROOT'
and not the 'my_app's one. As a result I've lost a lot of time trying to
figure out why my jspages did not take into account my modifications.

- Is there a way to get rid of the 'ROOT' directory.
- Is it possible to specify unambiguously the name of the default directory.

-- 
___________________________________________________________________

Jean-Paul Le Fèvre  * Mail : LeFevre@fonteny.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Renaming the ROOT directory ?

Posted by Steve Job <to...@wwwcrazy.com>.
Quoting Jean-Paul Le Fèvre <Le...@fonteny.org>:

> - Is there a way to get rid of the 'ROOT' directory.
> - Is it possible to specify unambiguously the name of the default directory.
>

If you are using a UNIX-like OS I have had good luck by just create symbolic
links for the ROOT directory and point it where I want to.

So something like:
ln -s /my/path/of/what/I/want /usr/local/tomcat/webapps/ROOT

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Renaming the ROOT directory ?

Posted by John Villar <jo...@florhard.com>.
>      <Host name="edbg.fr" debug = "0" appBase="webapps/eros" 
>            unpackWARs="true" autoDeploy="true">
>
>            <Logger className="org.apache.catalina.logger.FileLogger"
>                    directory="logs"  prefix="eros-" suffix=".log" />
>
>            <Context path = ""  docBase = "edbg.war" debug = "0" 
>                     override = "true"  reloadable="true"
>                     useNaming = "false" swallowOutput = "true" >
>            </Context>
> 
>  
>
Try the following (i'm basing my comments from my tomcat distro, 5.0.27 
probably has the same functionality):

There should be a directory in your conf dir called "Catalina", inside 
there should be directory for every virtual host (i.e. "edbg.fr"), and 
inside the host dir there should be a XML file for every context (i.e. 
"edbg"). I have autodeployed wars and they do not include the ".war" 
extension on the context docBase, it just includes everything before the 
dot. I don't have any context definitions in my server.xml file thanks 
to this layout. You should end with 1 XML file named ROOT.xml in every 
virtual host directory with contents like this:

<?xml version='1.0' encoding='utf-8'?>
<Context  docBase="edbg" path="" debug = "0" override = "true"
                reloadable="true" useNaming = "false" swallowOutput = 
"true">
</Context>

that should do the trick, if you write those three files, be sure to 
delete your context definition from server.xml


Re: Renaming the ROOT directory ?

Posted by Jean-Paul Le Fèvre <Le...@fonteny.org>.
On Saturday 18 September 2004 16:42, John Villar wrote:
> What's your tomcat version? could you post your server.xml file to see
> if there's something wrong? i'm using virtual hosts with default apps on
> tomcat 5.0.18 and used the configuration i told you, and works pretty
> well......

      tomcat-5.0.27

      <Host name="edbg.fr" debug = "0" appBase="webapps/eros" 
            unpackWARs="true" autoDeploy="true">

            <Logger className="org.apache.catalina.logger.FileLogger"
                    directory="logs"  prefix="eros-" suffix=".log" />

            <Context path = ""  docBase = "edbg.war" debug = "0" 
                     override = "true"  reloadable="true"
                     useNaming = "false" swallowOutput = "true" >
            </Context>
 
-- 
___________________________________________________________________

Jean-Paul Le Fèvre  * Mail : LeFevre@fonteny.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Renaming the ROOT directory ?

Posted by John Villar <jo...@florhard.com>.
What's your tomcat version? could you post your server.xml file to see 
if there's something wrong? i'm using virtual hosts with default apps on 
tomcat 5.0.18 and used the configuration i told you, and works pretty 
well......

John Villar
Gerente de Proyectos
Computadores Flor Hard Soft 2058 C.A.
www.florhard.com



Jean-Paul Le Fèvre escribió:

>On Saturday 18 September 2004 14:13, John Villar wrote:
>  
>
>>Your path attribute should have "/" and not "".
>>    
>>
>
>No. According to the tomcat config doc :
>
>"If you specify a context path of an empty string (""), you are defining the 
>default web application for this Host..."
>
>Docbase should be (for
>  
>
>>your case, i will explain why it is wrong) "webapps/my_app". This is a
>>bad configuration, because you're telling to your host that its root dir
>>is within the root of another host.
>>    
>>
>
>No. My <Host> definitions have each an appBase="webapps/a_host"
>
>better approach IMHO: create one
>  
>
>>"webapps" dir for every virtual host, say "webapps2" and "webapps3"
>>(keeping one host with the default webapps) and point the 2nd host to
>>"webapps2" and your 3rd host to "webapps3", then create for every host a
>>default context with <Context path="/" docBase="my_app"/> and voila, you
>>have 3 virtual hosts each one with its default context.
>>    
>>
>
>And 'voilà pas du tout' since you describe my current configuration which
>cause the problem.
>
>In fact the trick with the symbolic link works but it is not elegant.
>I wonder whether this forced ROOT creation is a bug or a feature.
>
>  
>


Re: Renaming the ROOT directory ?

Posted by Jean-Paul Le Fèvre <Le...@fonteny.org>.
On Saturday 18 September 2004 14:13, John Villar wrote:
> Your path attribute should have "/" and not "".

No. According to the tomcat config doc :

"If you specify a context path of an empty string (""), you are defining the 
default web application for this Host..."

Docbase should be (for
> your case, i will explain why it is wrong) "webapps/my_app". This is a
> bad configuration, because you're telling to your host that its root dir
> is within the root of another host.

No. My <Host> definitions have each an appBase="webapps/a_host"

better approach IMHO: create one
> "webapps" dir for every virtual host, say "webapps2" and "webapps3"
> (keeping one host with the default webapps) and point the 2nd host to
> "webapps2" and your 3rd host to "webapps3", then create for every host a
> default context with <Context path="/" docBase="my_app"/> and voila, you
> have 3 virtual hosts each one with its default context.

And 'voilà pas du tout' since you describe my current configuration which
cause the problem.

In fact the trick with the symbolic link works but it is not elegant.
I wonder whether this forced ROOT creation is a bug or a feature.

-- 
___________________________________________________________________

Jean-Paul Le Fèvre  * Mail : LeFevre@fonteny.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Renaming the ROOT directory ?

Posted by John Villar <jo...@florhard.com>.
Your path attribute should have "/" and not "". Docbase should be (for 
your case, i will explain why it is wrong) "webapps/my_app". This is a 
bad configuration, because you're telling to your host that its root dir 
is within the root of another host. better approach IMHO: create one 
"webapps" dir for every virtual host, say "webapps2" and "webapps3" 
(keeping one host with the default webapps) and point the 2nd host to 
"webapps2" and your 3rd host to "webapps3", then create for every host a 
default context with <Context path="/" docBase="my_app"/> and voila, you 
have 3 virtual hosts each one with its default context.

John Villar
Gerente de Proyectos
Computadores Flor Hard Soft 2058 C.A.
www.florhard.com



Jean-Paul Le Fèvre escribió:

>I don't understand how to specify a default context.
>I'm currently working with tomcat-5.0.27 and my server
>is supporting 3 virtual hosts.
>
>In the config file (server.xml) I declare a default context
>with :
>     <Context path = "" docBase = "my_app" ...
>
>The directory 'my_app' is available in the 'webapps' directory.
>Depending on the case it is directly copied or extracted from a
>war file.
>However when the application is deployed a 'ROOT' directory is automatically
>created. Its content duplicates the one in 'my_app'.
>
>When I update something in 'my_app' the copy in 'ROOT' is not synchronized
>and the 2 directories become different.
>
>The problem is that tomcat is actually serving the content of 'ROOT'
>and not the 'my_app's one. As a result I've lost a lot of time trying to
>figure out why my jspages did not take into account my modifications.
>
>- Is there a way to get rid of the 'ROOT' directory.
>- Is it possible to specify unambiguously the name of the default directory.
>
>  
>