Re: Setting context in tomcat6

2008-07-15 Thread David Smith
Rename your app ROOT (case is important here) and it will become the 
default webapp. 


--David

vibhuti wrote:

Hi

 


I've been trying to set my application as default application using tomcat6
but none of the approaches I tried  worked. 

 


First, I created a file .xml in /tomcat/conf/Catalina/localhost
folder but this did not make my application default. It worked on tomcat5
but not on tomcat6. Following are the entries of my myapp.xml file:

 




 


I want to access my application as: http://localhost:8080/ instead of
http://localhost:8080/myapp

 


Second, I tried creating context.xml in /webapps/myapp/META-INF folder with
same contents as given above but that didn't work.

 


It is written in tomcat docs that the  tag should not be used in
server.xml, but adding the tag to server.xml seemed the only solution. Also,
when I added  tag to server.xml it worked but the context seemed to
be loaded twice by tomcat.

 


Is there any alternative to adding  tag to server.xml file?  Why is
it not advisable to add the  tag in server.xml?

 


Please provide a workaround for this. It is urgent.

 


Thanks

 



  



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



RE: Setting context in tomcat6

2008-07-15 Thread vibhuti
Thanks a lot for the prompt reply. I have tried doing that but in that case
I will not be able to access my application using URL
http://localhost:8080/myapp/, I'll just be able to access it using
http://localhost:8080/
I want the users of my web application to be able to access it using both
the URLs. This is the requirement of our project.

Thanks
Vibhuti

-Original Message-
From: David Smith [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 15, 2008 6:44 PM
To: Tomcat Users List
Subject: Re: Setting context in tomcat6

Rename your app ROOT (case is important here) and it will become the 
default webapp. 

--David

vibhuti wrote:
> Hi
>
>  
>
> I've been trying to set my application as default application using
tomcat6
> but none of the approaches I tried  worked. 
>
>  
>
> First, I created a file .xml in /tomcat/conf/Catalina/localhost
> folder but this did not make my application default. It worked on tomcat5
> but not on tomcat6. Following are the entries of my myapp.xml file:
>
>  
>
> 
>
>  
>
> I want to access my application as: http://localhost:8080/ instead of
> http://localhost:8080/myapp
>
>  
>
> Second, I tried creating context.xml in /webapps/myapp/META-INF folder
with
> same contents as given above but that didn't work.
>
>  
>
> It is written in tomcat docs that the  tag should not be used in
> server.xml, but adding the tag to server.xml seemed the only solution.
Also,
> when I added  tag to server.xml it worked but the context seemed
to
> be loaded twice by tomcat.
>
>  
>
> Is there any alternative to adding  tag to server.xml file?  Why
is
> it not advisable to add the  tag in server.xml?
>
>  
>
> Please provide a workaround for this. It is urgent.
>
>  
>
> Thanks
>
>  
>
>
>   


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



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



Re: Setting context in tomcat6

2008-07-15 Thread Mark Thomas

vibhuti wrote:

Thanks a lot for the prompt reply. I have tried doing that but in that case
I will not be able to access my application using URL
http://localhost:8080/myapp/, I'll just be able to access it using
http://localhost:8080/
I want the users of my web application to be able to access it using both
the URLs. This is the requirement of our project.


Simplest solution is to deploy the app twice. Rather than renaming your app 
to ROOT, copy it to ROOT.


Mark



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



RE: Setting context in tomcat6

2008-07-15 Thread Caldarale, Charles R
> From: vibhuti [mailto:[EMAIL PROTECTED]
> Subject: RE: Setting context in tomcat6
>
> I will not be able to access my application using URL
> http://localhost:8080/myapp/, I'll just be able to access it using
> http://localhost:8080/
> I want the users of my web application to be able to access
> it using both the URLs. This is the requirement of our project.

Sounds like a pointy-haired boss thing.

Do you want the app deployed twice, once as the default and once as myapp?  Or 
do you want both URLs to access the same instance of the app?

If the former, then deploy the app twice, once as ROOT and once as myapp.

If the latter, then write a filter for the lesser-used URL that redirects or 
forwards to the proper one.

 - 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Setting context in tomcat6

2008-07-16 Thread vibhuti
If anyone could clarify one doubt, that why is it that in tomcat5 we define
a context descriptor file myapp.xml in /tomcat/conf/Catalina/localhost
folder and a default context could be set but in tomcat6 it doesn't work.

-Original Message-
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 15, 2008 7:28 PM
To: Tomcat Users List
Subject: Re: Setting context in tomcat6

vibhuti wrote:
> Thanks a lot for the prompt reply. I have tried doing that but in that
case
> I will not be able to access my application using URL
> http://localhost:8080/myapp/, I'll just be able to access it using
> http://localhost:8080/
> I want the users of my web application to be able to access it using both
> the URLs. This is the requirement of our project.

Simplest solution is to deploy the app twice. Rather than renaming your app 
to ROOT, copy it to ROOT.

Mark



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



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



RE: Setting context in tomcat6

2008-07-16 Thread Caldarale, Charles R
> From: vibhuti [mailto:[EMAIL PROTECTED]
> Subject: RE: Setting context in tomcat6
>
> why is it that in tomcat5 we define a context descriptor
> file myapp.xml in /tomcat/conf/Catalina/localhost folder
> and a default context could be set but in tomcat6 it
> doesn't work.

Depends on what you mean by "doesn't work".  The configuration you were using 
was invalid for all levels, but it just happened to do something that you 
decided was useful.  That erroneous and accidental behavior has been fixed in 
more recent levels.

 - 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Setting context in tomcat6

2008-07-18 Thread vibhuti
This is mentioned in tomcat documentation and I just followed what was
written there. Here is the link:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

It says 
Context elements may be explicitly defined: 

 - in individual files (with a ".xml" extension) in the
$CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file
(less the .xml extension) will be used as the context path. Multi-level
context paths may be defined using #, e.g. context#path.xml. The default web
application may be defined by using a file called ROOT.xml.

If this is erroneous then renaming or using filter are the only ways? 

Thanks

-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 16, 2008 7:44 PM
To: Tomcat Users List
Subject: RE: Setting context in tomcat6

> From: vibhuti [mailto:[EMAIL PROTECTED]
> Subject: RE: Setting context in tomcat6
>
> why is it that in tomcat5 we define a context descriptor
> file myapp.xml in /tomcat/conf/Catalina/localhost folder
> and a default context could be set but in tomcat6 it
> doesn't work.

Depends on what you mean by "doesn't work".  The configuration you were
using was invalid for all levels, but it just happened to do something that
you decided was useful.  That erroneous and accidental behavior has been
fixed in more recent levels.

 - 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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



Re: Setting context in tomcat6

2008-07-18 Thread Charles Caldarale

On Jul 18, 2008, at 2:12, "vibhuti" <[EMAIL PROTECTED]> wrote:


This is mentioned in tomcat documentation and I just followed what was
written there. Here is the link:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html



If this is erroneous then renaming or using filter are the only ways?


It's neither erroneous nor inconsistent with what you've already been  
told. Besides the section of the doc that you quoted, read the  
descriptions of the path and docBase attributes. Note that you must  
not use a path attribute here, and the docBase attribute is redundant  
(ignored, at best) when the app is located in the  appBase  
directory.


 - Chuck


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



RE: Setting context in tomcat6

2008-07-22 Thread vibhuti
I'm using tomcat6. If what is written in tomcat docs is not inconsistent
then why I am not able to set an explicit context for my web application by
the following entries in myapp.xml (placed at /conf/Catalina/localhost)



You have written that docbase attribute is redundant if application is
situated in  appBase directory and path attribute must not be used,
but it is the path attribute, where we specify the context we want to use
for our web application. Also, it is the docbase attribute that specifies,
for which web application (present under appBase folder) will the context
apply. 

I have been trying to understand how to explicitly define contexts in
tomcat, read tomcat docs and searched a lot on net but none seems to provide
me complete understanding of it. 

I would like to mention here certain things in case of tomcat6 :

1. Trying to set explicit context using myapp.xml placed under
(/conf/Catalina/localhost) doesn't set the context.

2. We can also set context using server.xml but tomcat docs strongly
recommend not to se it. It says that:

"This is because it makes modifying the Context configuration more invasive
since the main conf/server.xml file cannot be reloaded without restarting
Tomcat."

But what are the drawbacks of this approach? 

3. Placing context.xml in META-INF folder also doesn't set the context.
 
Is there any other way also to set explicit contexts? I do not want to
deploy my application twice or rename any folder. 

It will be great if anyone could answer the above queries.

 


-Original Message-
From: Charles Caldarale [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 18, 2008 6:55 PM
To: Tomcat Users List
Subject: Re: Setting context in tomcat6

On Jul 18, 2008, at 2:12, "vibhuti" <[EMAIL PROTECTED]> wrote:

> This is mentioned in tomcat documentation and I just followed what was
> written there. Here is the link:
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

> If this is erroneous then renaming or using filter are the only ways?

It's neither erroneous nor inconsistent with what you've already been  
told. Besides the section of the doc that you quoted, read the  
descriptions of the path and docBase attributes. Note that you must  
not use a path attribute here, and the docBase attribute is redundant  
(ignored, at best) when the app is located in the  appBase  
directory.

  - Chuck


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



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



RE: Setting context in tomcat6

2008-07-22 Thread Caldarale, Charles R
> From: vibhuti [mailto:[EMAIL PROTECTED]
> Subject: RE: Setting context in tomcat6
>
> If what is written in tomcat docs is not inconsistent
> then why I am not able to set an explicit context for
> my web application by the following entries in myapp.xml
> (placed at /conf/Catalina/localhost)

You're using the word "context" rather ambiguously; do you mean path, docBase, 
or what?

> 

As the doc specifically states, the default webapp must be named ROOT, and the 
path attribute is ignored unless the  element is in server.xml, which 
is very strongly discouraged.

> but it is the path attribute, where we specify the context we
> want to use for our web application.

Not any more; that went away with Tomcat 4.  For Tomcat 5 and above, you 
specify the URL path via the name of the webapp or the name of the .xml file in 
the conf/Catalina/[host] directory.

> Also, it is the docbase attribute that specifies,
> for which web application (present under appBase
> folder) will the context apply.

No; if the webapp is deployed under the  appBase directory, the docBase 
attribute isn't used.  The only time docBase is useful is if the webapp is 
placed somewhere other than under appBase.

> I have been trying to understand how to explicitly define
> contexts in tomcat, read tomcat docs and searched a lot
> on net but none seems to provide me complete understanding
> of it.

Again assuming by "context" you mean URL path, it's very simple: normally, the 
name of the webapp directory or .war file is the URL path.  If that's not 
adequate, you may specify the URL path by placing a  element in a file 
called [appName].xml under the conf/Catalina/[host] directory; the [appName] is 
then used as the URL path.  Should you take the latter approach, the webapp 
must be located in [appBase]/[appName], or it must be somewhere other than 
under [appBase] and a docBase attribute is required in the  element.

> 1. Trying to set explicit context using myapp.xml placed under
> (/conf/Catalina/localhost) doesn't set the context.

Because the path attribute is not allowed.

> 2. We can also set context using server.xml but tomcat
> docs strongly recommend not to se it.
> But what are the drawbacks of this approach?

You have to restart Tomcat anytime you want to change attributes of the webapp. 
 The simplest place to keep the  element (if you need one at all) is 
in the webapp's META-INF/context.xml file, so it is packaged with the webapp.

> 3. Placing context.xml in META-INF folder also doesn't set
> the context.

Correct; again, the name of the webapp is the URL path to it.

> Is there any other way also to set explicit contexts?

Not really.  Name your webapp properly and you won't have a problem.  Just 
follow the standard practice.

 - 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Setting context in tomcat6

2008-07-23 Thread vibhuti
Thank you so much for the prompt reply and answering all the questions so
well. I thought "context" and URL path mean the same. I apologize if this
caused confusion. In my mails wherever I wrote "context" I meant "URL path".


Now I believe I understand how url paths are set in tomcat. Either using
name of the web application or using [appname].xml file placed at
/conf/Catalina/[host] location are the only ways to specify the URL path of
a web application. The approach I was trying to use worked with tomcat4, it
some how worked with tomcat5 and I was trying to apply it to tomcat 6 also
which was wrong.

So one question remains; if I want that URL http://localhost:8080/ should
redirect user to the home page of my application then what should I do? I
mean I don't want the tomcat home page to be displayed.

One more query I have regarding the description you gave about defining
 element in server.xml. You wrote:
"You have to restart Tomcat anytime you want to change attributes of the
webapp."
What does attribute of web application exactly mean? If there are no changes
made to the application attributes then can we use  element in
server.xml or using a  element in server.xml will have some adverse
effects on the way web application behaves. 

Thanks



-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 23, 2008 11:55 AM
To: Tomcat Users List
Subject: RE: Setting context in tomcat6

> From: vibhuti [mailto:[EMAIL PROTECTED]
> Subject: RE: Setting context in tomcat6
>
> If what is written in tomcat docs is not inconsistent
> then why I am not able to set an explicit context for
> my web application by the following entries in myapp.xml
> (placed at /conf/Catalina/localhost)

You're using the word "context" rather ambiguously; do you mean path,
docBase, or what?

> 

As the doc specifically states, the default webapp must be named ROOT, and
the path attribute is ignored unless the  element is in server.xml,
which is very strongly discouraged.

> but it is the path attribute, where we specify the context we
> want to use for our web application.

Not any more; that went away with Tomcat 4.  For Tomcat 5 and above, you
specify the URL path via the name of the webapp or the name of the .xml file
in the conf/Catalina/[host] directory.

> Also, it is the docbase attribute that specifies,
> for which web application (present under appBase
> folder) will the context apply.

No; if the webapp is deployed under the  appBase directory, the
docBase attribute isn't used.  The only time docBase is useful is if the
webapp is placed somewhere other than under appBase.

> I have been trying to understand how to explicitly define
> contexts in tomcat, read tomcat docs and searched a lot
> on net but none seems to provide me complete understanding
> of it.

Again assuming by "context" you mean URL path, it's very simple: normally,
the name of the webapp directory or .war file is the URL path.  If that's
not adequate, you may specify the URL path by placing a  element in
a file called [appName].xml under the conf/Catalina/[host] directory; the
[appName] is then used as the URL path.  Should you take the latter
approach, the webapp must be located in [appBase]/[appName], or it must be
somewhere other than under [appBase] and a docBase attribute is required in
the  element.

> 1. Trying to set explicit context using myapp.xml placed under
> (/conf/Catalina/localhost) doesn't set the context.

Because the path attribute is not allowed.

> 2. We can also set context using server.xml but tomcat
> docs strongly recommend not to se it.
> But what are the drawbacks of this approach?

You have to restart Tomcat anytime you want to change attributes of the
webapp.  The simplest place to keep the  element (if you need one
at all) is in the webapp's META-INF/context.xml file, so it is packaged with
the webapp.

> 3. Placing context.xml in META-INF folder also doesn't set
> the context.

Correct; again, the name of the webapp is the URL path to it.

> Is there any other way also to set explicit contexts?

Not really.  Name your webapp properly and you won't have a problem.  Just
follow the standard practice.

 - 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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



RE: Setting context in tomcat6

2008-07-23 Thread Marco de Booy


vibhuti-2 wrote:
> 
> Correct; again, the name of the webapp is the URL path to it.
> 
>> Is there any other way also to set explicit contexts?
> 
> Not really.  Name your webapp properly and you won't have a problem.  Just
> follow the standard practice.
> 
>  - Chuck
> 

Just to be sure that I understand it correctly. If I use maven to generate
my myapp-version.war file the application will always be called
http://localhost:8080/myapp-version unless I rename the war file as
myapp.war (which gives http://localhost:8080/myapp which looks better for
the user in my opinion) before I deploy it. Since path does not work I can
not 'rename' it with the META-INF/context.xml. Neither gives putting the
file myapp.xml in the conf/localhost the possibility to 'rename'
myapp-version to myapp.

Marco

-- 
View this message in context: 
http://www.nabble.com/Setting-context-in-tomcat6-tp18464841p18609619.html
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Setting context in tomcat6

2008-07-23 Thread Caldarale, Charles R
> From: vibhuti [mailto:[EMAIL PROTECTED]
> Subject: RE: Setting context in tomcat6
>
> if I want that URL http://localhost:8080/ should
> redirect user to the home page of my application
> then what should I do?

The default webapp must be named ROOT (case sensitive).  You'll need to delete 
(or rename) Tomcat's default ROOT directory, and replace it with your webapp 
(ROOT directory or ROOT.war file).

> What does attribute of web application exactly mean?

Anything defined for the webapp inside the  element, such as 
resources, valves, etc.

> If there are no changes made to the application attributes
> then can we use  element in server.xml or using a
>  element in server.xml will have some adverse
> effects on the way web application behaves.

I don't know how much longer that  elements inside server.xml will be 
supported; the idea is to keep application information and Tomcat information 
separate, and lumping it all into server.xml is counter to that.  Also, you run 
the risk of multiple and conflicting deployments with  elements in 
server.xml and inconsistently named webapps in the appBase directory.  As I 
said before, make your life simpler by following standard practice, not what 
was current many years ago.

 - 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Setting context in tomcat6

2008-07-23 Thread Caldarale, Charles R
> From: Marco de Booy [mailto:[EMAIL PROTECTED]
> Subject: RE: Setting context in tomcat6
>
> Since path does not work I can not 'rename' it with the
> META-INF/context.xml. Neither gives putting the file
> myapp.xml in the conf/localhost the possibility to 'rename'
> myapp-version to myapp.

Correct.  Adjust your deployment script to strip off the version before copying 
it into the appBase directory.

 - 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]