You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jojo Paderes <jo...@gmail.com> on 2004/11/05 12:44:57 UTC

Setting Context Path of Webapp as Root on Tomcat 5.5.3

Hi,

Is there a way to set a webapp to use the root context path in Tomcat
5.5.3. For example, I want to access by webapp named "mywebapp" by
using this url:

http://mydomain.com/

instead of this:

http://mydomain.com/mywebapp/

In a J2EE EAR file, I can set the webapp to use the root context path
by setting the <context-root> value to /. I'm looking for a similar
way on WAR file deployed on Tomcat.

I was able to do this by just renaming my webapp to ROOT, but I prefer
something else. Any suggestions?


regards,

jOjO

-- 
My Blogs http://www.jroller.com/page/jojopaderes/blog
Pinoy Tech Scene http://pinoytechscene.mparaz.com
PinoyJUG http://www.pinoyjug.ph

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


Re: AW: Setting Context Path of Webapp as Root on Tomcat 5.5.3

Posted by Jojo Paderes <jo...@gmail.com>.
Hi Remy,

Would this mean that the path and docBase attributes are of no use
when configured in the META-INF/context.xml in WAR files?

If that is the case, then we need to set these attributes in the
$CATALINA_HOME/conf/server.xml if we want to customize the context
path of our web apps.


regards,

jOjO

On Fri, 5 Nov 2004 13:41:54 +0100, Remy Maucherat
<re...@gmail.com> wrote:
> Since the path attribute is redundant information, it is ignored in
> context.xml files. Same for docBase in many cases.
> Please do not open a bug report about this, or propose switching back
> to the old behavior.
> 
> --
> xxxxxxxxxxxxxxxxxxxxxxxxx
> Rémy Maucherat
> Developer & Consultant
> JBoss Group (Europe) SàRL
> xxxxxxxxxxxxxxxxxxxxxxxxx

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


RE: AW: Setting Context Path of Webapp as Root on Tomcat 5.5.3

Posted by Steve Kirk <to...@web-startup.co.uk>.
Remy, the server config reference at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html

says, "Each such Context MUST have a unique context path, which is defined
by the path attribute" which implies that we must include the path attribute
in a <Context>, wherever it is configured.  Perhaps the docs do need a
slight fix to reflect what you say below?

> Since the path attribute is redundant information, it is ignored in
> context.xml files. Same for docBase in many cases.
> Please do not open a bug report about this, or propose switching back
> to the old behavior.
> 
> -- 
> xxxxxxxxxxxxxxxxxxxxxxxxx
> Rémy Maucherat
> Developer & Consultant
> JBoss Group (Europe) SàRL
> xxxxxxxxxxxxxxxxxxxxxxxxx



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


Re: AW: Setting Context Path of Webapp as Root on Tomcat 5.5.3

Posted by Remy Maucherat <re...@gmail.com>.
On Fri, 5 Nov 2004 20:23:30 +0800, Jojo Paderes <jo...@gmail.com> wrote:
> Here's my context.xml file:
> 
> <Context displayName="My Web App"
>        path=""
>        docBase="mywebapp.war"
>        reloadable="true"
>        useNaming="true"
>        debug="5"
>        unpackWAR="true">
> </Context>
> 
> Seems to be not working either. When I access the root context
> (http://localhost), I still get the Tomcat default page and not my
> webapp's index page. I'm deploying my webapp on a default Tomcat 5.5.3
> setup. I will try this on 5.5.4.

Since the path attribute is redundant information, it is ignored in
context.xml files. Same for docBase in many cases.
Please do not open a bug report about this, or propose switching back
to the old behavior.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

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


AW: AW: Setting Context Path of Webapp as Root on Tomcat 5.5.3

Posted by Nick Pellow <ni...@mindmatics.de>.
Hi Jojo,

You should make sure that you delete the ROOT directory under
${CATALINE_HOME}/webapps .
If you are still seeing the tomcat default page, then this means that
the TOMCAT default ROOT app is still deployed somewhere...

Cheers,
nick.



>-----Ursprungliche Nachricht-----
>Von: Jojo Paderes [mailto:jojo.paderes@gmail.com]
>Gesendet: Freitag, 5. November 2004 13:24
>An: tomcat-user@jakarta.apache.org
>Betreff: Re: AW: Setting Context Path of Webapp as Root on Tomcat 5.5.3
>
>
>Here's my context.xml file:
>
><Context displayName="My Web App"
>       path=""
>       docBase="mywebapp.war"
>       reloadable="true"
>       useNaming="true"
>       debug="5"
>       unpackWAR="true">
></Context>
>
>Seems to be not working either. When I access the root context
>(http://localhost), I still get the Tomcat default page and not my
>webapp's index page. I'm deploying my webapp on a default Tomcat 5.5.3
>setup. I will try this on 5.5.4.
>
>Am I missing something here like some configurations on the server.xml
>or web.xml under $CATALINA_HOME/conf/?
>
>The simplest solution, as Nick suggested, is to rename my webapp WAR
>file to ROOT.war. I'm looking at a solution similar on a typical EAR
>file deployment on a J2EE app (i.e. Jboss) where I can specify my
>webapp to use the root context path in the application.xml file.
>
>On Fri, 5 Nov 2004 13:00:15 +0100, Nick Pellow
><ni...@mindmatics.de> wrote:
>> Hi Jojo,
>>
>> I wanted to do the same as you. I got it to work,
>> when the context path is the empty string "".
>> ie.
>> <Context path="" docBase="myrootapp.war"
>>
>> What however was annoying, was that tomcat then unpacks
>> this war in a directory called ROOT. Hence, when you restart
>> tomcat, it deploys the webapp under ROOT with context of /,
>> *and*, the webapp called myrootapp.war with context of /myrootapp .
>>
>> Problem was, that I have my META-INF/context.xml in myrootapp.
>> This seems to cause a lot of confusion for tomcat.
>>
>> The cleanest solution I found, was to call myrootapp.war ROOT.war...
>>
>> I would like to know a neater solution if there is one..
>>
>> Cheers,
>> nick
>>
>> >-----Ursprungliche Nachricht-----
>> >Von: Jojo Paderes [mailto:jojo.paderes@gmail.com]
>> >Gesendet: Freitag, 5. November 2004 12:45
>> >An: tomcat-user@jakarta.apache.org
>> >Betreff: Setting Context Path of Webapp as Root on Tomcat 5.5.3
>> >
>> >
>> >Hi,
>> >
>> >Is there a way to set a webapp to use the root context path in Tomcat
>> >5.5.3. For example, I want to access by webapp named "mywebapp" by
>> >using this url:
>> >
>> >http://mydomain.com/
>> >
>> >instead of this:
>> >
>> >http://mydomain.com/mywebapp/
>> >
>> >In a J2EE EAR file, I can set the webapp to use the root context path
>> >by setting the <context-root> value to /. I'm looking for a similar
>> >way on WAR file deployed on Tomcat.
>> >
>> >I was able to do this by just renaming my webapp to ROOT, but I prefer
>> >something else. Any suggestions?
>> >
>> >
>> >regards,
>> >
>> >jOjO
>
>---------------------------------------------------------------------
>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: AW: Setting Context Path of Webapp as Root on Tomcat 5.5.3

Posted by Jojo Paderes <jo...@gmail.com>.
Here's my context.xml file:

<Context displayName="My Web App"
       path=""
       docBase="mywebapp.war"
       reloadable="true"
       useNaming="true"
       debug="5"
       unpackWAR="true">
</Context>

Seems to be not working either. When I access the root context
(http://localhost), I still get the Tomcat default page and not my
webapp's index page. I'm deploying my webapp on a default Tomcat 5.5.3
setup. I will try this on 5.5.4.

Am I missing something here like some configurations on the server.xml
or web.xml under $CATALINA_HOME/conf/?

The simplest solution, as Nick suggested, is to rename my webapp WAR
file to ROOT.war. I'm looking at a solution similar on a typical EAR
file deployment on a J2EE app (i.e. Jboss) where I can specify my
webapp to use the root context path in the application.xml file.

On Fri, 5 Nov 2004 13:00:15 +0100, Nick Pellow
<ni...@mindmatics.de> wrote:
> Hi Jojo,
> 
> I wanted to do the same as you. I got it to work,
> when the context path is the empty string "".
> ie.
> <Context path="" docBase="myrootapp.war"
> 
> What however was annoying, was that tomcat then unpacks
> this war in a directory called ROOT. Hence, when you restart
> tomcat, it deploys the webapp under ROOT with context of /,
> *and*, the webapp called myrootapp.war with context of /myrootapp .
> 
> Problem was, that I have my META-INF/context.xml in myrootapp.
> This seems to cause a lot of confusion for tomcat.
> 
> The cleanest solution I found, was to call myrootapp.war ROOT.war...
> 
> I would like to know a neater solution if there is one..
> 
> Cheers,
> nick
> 
> >-----Ursprungliche Nachricht-----
> >Von: Jojo Paderes [mailto:jojo.paderes@gmail.com]
> >Gesendet: Freitag, 5. November 2004 12:45
> >An: tomcat-user@jakarta.apache.org
> >Betreff: Setting Context Path of Webapp as Root on Tomcat 5.5.3
> >
> >
> >Hi,
> >
> >Is there a way to set a webapp to use the root context path in Tomcat
> >5.5.3. For example, I want to access by webapp named "mywebapp" by
> >using this url:
> >
> >http://mydomain.com/
> >
> >instead of this:
> >
> >http://mydomain.com/mywebapp/
> >
> >In a J2EE EAR file, I can set the webapp to use the root context path
> >by setting the <context-root> value to /. I'm looking for a similar
> >way on WAR file deployed on Tomcat.
> >
> >I was able to do this by just renaming my webapp to ROOT, but I prefer
> >something else. Any suggestions?
> >
> >
> >regards,
> >
> >jOjO

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


Re: Setting Context Path of Webapp as Root on Tomcat 5.5.3

Posted by Jojo Paderes <jo...@gmail.com>.
I got it to work by adding a <Context> entry in the
$CATALINA_HOME/conf/server.xml file. I added this entry inside the
default <Host> element:

. . .

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

<Context displayName="mywebapp"
         path=""
         docBase="mywebapp">
</Context>

. . .

It's working with this configuration on Tomcat 5.5.3 and 5.5.4. I can
now view the index page of my web app.

Thanks for all those who replied! :)


On Fri, 5 Nov 2004 12:48:18 -0000, Steve Kirk
<to...@web-startup.co.uk> wrote:
> This was answered on this list last week.  So it's in the archive:
> http://nagoya.apache.org/eyebrowse/SearchList?listName=tomcat-user@jakarta.a
> pache.org
> 
> From memory I think you get rid of the ROOT webapp and set the context path
> of mywebapp to "/" ?

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


RE: Setting Context Path of Webapp as Root on Tomcat 5.5.3

Posted by Steve Kirk <to...@web-startup.co.uk>.
This was answered on this list last week.  So it's in the archive: 
http://nagoya.apache.org/eyebrowse/SearchList?listName=tomcat-user@jakarta.a
pache.org 

>From memory I think you get rid of the ROOT webapp and set the context path
of mywebapp to "/" ?

> -----Original Message-----
> From: Jojo Paderes [mailto:jojo.paderes@gmail.com] 
> Sent: Friday 05 November 2004 11:45
> To: tomcat-user@jakarta.apache.org
> Subject: Setting Context Path of Webapp as Root on Tomcat 5.5.3
> 
> 
> Hi,
> 
> Is there a way to set a webapp to use the root context path in Tomcat
> 5.5.3. For example, I want to access by webapp named "mywebapp" by
> using this url:
> 
> http://mydomain.com/
> 
> instead of this:
> 
> http://mydomain.com/mywebapp/
> 
> In a J2EE EAR file, I can set the webapp to use the root context path
> by setting the <context-root> value to /. I'm looking for a similar
> way on WAR file deployed on Tomcat.
> 
> I was able to do this by just renaming my webapp to ROOT, but I prefer
> something else. Any suggestions?
> 
> 
> regards,
> 
> jOjO
> 
> -- 
> My Blogs http://www.jroller.com/page/jojopaderes/blog
> Pinoy Tech Scene http://pinoytechscene.mparaz.com
> PinoyJUG http://www.pinoyjug.ph
> 
> ---------------------------------------------------------------------
> 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