In that case there would be no xml file as you have to put the context
element under the host element in the server.xml.
There is only two ways I know to define the default application
(www.eshipper.com/):
Use ROOT.war as the package name. (Or manually deploy it to a folder called
ROOT and use ROOT.xml.)
Set the path to "" in the server.xml.
<Host name="www.riz.com" appBase="rizapps" unpackWARs="true"
autoDeploy="true" workDir="work/Catalina/riz">
xmlValidation="false" xmlNamespaceAware="false">
<Context displayName="defaultApp" docBase="yourChoice" path=""
</Context>
</Host>
Whatever application that is in the yourChoice folder will serve as the
default app.
I am not sure and it would be neat to know if you could point the docBase to
another app that could be deployed and undeployed as normal.
So say you point it to rizbase and then deploy an application of
rizbase.war. Would it then point to the app as the default? Would
www.eshipper.com/ and www.eshipper.com/rizbase give you the same app?
Someone else on the list may have more info on this one.
I guess it is possible to not have a default app. Is there any reason you
don't want to name the file ROOT.war? Only the file name needs to be set to
ROOT and thus the folder created will be ROOT.
Hope I didn't confuse you too bad.
Doug
----- Original Message -----
From: "Rizwan Merchant" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Monday, May 15, 2006 5:51 PM
Subject: Re: More virtual hosting problems!!
So what would my context.xml look like if I did not want to name my app
ROOT.war.
Say I want to name my app under rizapps something like myapplication.war
...what would the settings be for docbase and path in this case? i.e there
would be no ROOT application under rizapps.
Thanks again! :)
Parsons Technical Services wrote:
I need to clarify that the context.xml should be part of the war. Note I
said should (my opinion again)for easy deployment of the app.
To deploy a new app riz2, simply place the war in the rizapps folder. It
should auto deploy and show up as www.eshipper.com/riz2 .
The ROOT.war is a special case that deploys the app as the default app
(same as path="").
If you bundle the context.xml as part of the war it will be used. You can
find further details for using the context at
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
Doug
----- Original Message ----- From: "Rizwan Merchant"
<[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Sunday, May 14, 2006 5:20 PM
Subject: Re: More virtual hosting problems!!
Doug,
Thanks for your efforts to help. I am back with more questions. Hope you
can still help.
I created a folder called $CATALINA_HOME/rizapps like you suggested
I added a war file called ROOT.war to this directory
The entry for the virtual host in my $CATALINA_HOME/conf/server.xml
looks like this..
<Host name="www.eshipper.com" appBase="rizapps" unpackWARs="true"
autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
As you suggested, I also created a folder called
$CATALINA_HOME/rizapps/META-INF with a file called context.xml which
looks like this
<Context displayName="riz" docBase="ROOT">
</Context>
The above works perfectly, but how do I add more apps to the rizapps
folder? When I tried to change ROOT.war to riz.war (and correspondingly
change the docBase to "riz") it stopped working (not sure why).
So if I have another app war called riz2.war where would i put this and
what entry would i need to make in the context.xml file under the
META-INF directory? Can I have more than 1 context element entry in the
context.xml file (1 for each app under rizapps)??
Hope my question is clear and that you can help me here.
Thanks,
-Riz.
Parsons Technical Services wrote:
First to your issue below.
Problems:
The workDir belongs in the Host section and not in the context.
The path to the workDir end in an underscore.
The default app is usually in a folder called ROOT.
The appBase would be better somewhere other than webapps. Maybe
"rizapps"(my opinion) Otherwise it would conflict with an app called
riz deployed in the default host.
<Host name="www.riz.com" appBase="rizapps" unpackWARs="true"
autoDeploy="true" workDir="work/Catalina/riz">
xmlValidation="false" xmlNamespaceAware="false">
<Context displayName="riz" docBase="ROOT" path=""
</Context>
</Host>
There is a way to use the ROOT.xml to deploy the default app for a
context. I am not familiar with it but this is my best guess.
To retry your first attempt:
Remove the Context element from above.
Deploy you app in a war named ROOT.war
Use META-INF/context.xml not ROOT.xml
In the META-INF/context.xml file remove the path element.
I ain't perfect so I may have a goof or three in the above stuff.
Doug
----- Original Message ----- From: "Rizwan Merchant"
<[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, May 12, 2006 4:39 PM
Subject: Re: More virtual hosting problems!!
dug deeper and figured that everytime I undeploy (delete the expanded
application directory and replace the war file), the virtual host does
not get resolved the first time the app is deployed. have to shut down
the server and restart for it to work!
any ideas? Please help...
Rizwan Merchant wrote:
Ok to add to the mix, here is some more weird stuff.
I have the virtual host stuff working using the following entry in
the server.xml
<Host name="www.riz.com" appBase="webapps/riz" unpackWARs="true"
autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context displayName="riz" docBase="" path=""
workDir="work/Catalina/riz/_">
</Context>
</Host>
when i start the server and type www.riz.com in the browser, it
doesnt resolve. I then have to shut down the server and restart
before www.riz.com gets resolved.
So basically for my virtual hosting to work, I have to start the
server twice to make it work!!!
Weird!!!!
Tim Lucia wrote:
The link/text you posted says "except when statically defining a
Context in
server.xml", which was the case in the example from the OP... The
above
statement is exactly opposite of what you posted, is it not? To my
recollection, and despite the fact that it is (now) frowned upon,
path="/something" has always worked in server.xml... since my days
with
Tomcat 3.x.
Tim
-----Original Message-----
From: Parsons Technical Services
[mailto:[EMAIL PROTECTED] Sent: Friday, May 12, 2006
7:57 AM
To: Tomcat Users List
Subject: Re: More virtual hosting problems!!
From http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
And look at the path element.
" The value of this field must not be set except when statically
defining a Context in server.xml, as it will be inferred from the
filenames used for either the .xml context file or the docBase. "
Now there is the issue of Tomcat version. What version is running?
I was basing my info on an assumption of a 5.5.x path.
The 5.0.x path is different.
Doug
----- Original Message ----- From: "Tim Lucia" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <users@tomcat.apache.org>
Sent: Friday, May 12, 2006 6:48 AM
Subject: RE: More virtual hosting problems!!
Where is this documented? I have had no problem doing this. Since
I now
put context files in conf/[Engine]/[Host], I went back and added
<Context
docBase="d:/tjl/Projects/log4jconfig"
path="/log4jconfig"/>
to my server.xml and http://localhost:8080/manager/list shows
OK - Listed applications for virtual host localhost
/admin:running:0:C:/Tomcat/server/webapps/admin
/host-manager:running:0:C:/Tomcat/server/webapps/host-manager
/log4jconfig:running:0:D:/tjl/Projects/Log4JConfig
/:running:0:ROOT
/manager:running:0:C:/Tomcat/server/webapps/manager
So I was able to put a path in the context and it was respected.
Tim
-----Original Message-----
From: Parsons Technical Services
[mailto:[EMAIL PROTECTED]
Sent: Thursday, May 11, 2006 11:12 PM
To: Tomcat Users List
Subject: Re: More virtual hosting problems!!
One issue is that the path element can only be set to "" when you
use it in
the server.xml.
Doug
----- Original Message ----- From: "Rizwan Merchant"
<[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Thursday, May 11, 2006 1:37 PM
Subject: Re: More virtual hosting problems!!
I got this working now by moving the Context definition from the
ROOT.xml
to the server.xml under the <Host> tag as follows
<Host name="www.riz.com" appBase="webapps/riz"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context displayName="riz" docBase="" path=""
workDir="work/Catalina/riz/_">
</Context>
</Host>
I got rid of the www.riz.com directory under
$CATALINA_HOME/conf/Catalina
But I did read somewhere that it is not recommended to put the
Context
definition in the server.xml file.
Can someone please explain why the first scenario did not work and
the
above does, although it is not recommded.
Thanks,
-Riz.
Rizwan Merchant wrote:
Hi all!
I have been following the mailing list and it seems this is a
common
problem amongst many users. But I could not find a solution to my
problem, hence this post. Hope someone can help me.
I am trying to set up a simple virtual host for the domain
www.riz.com on
tomcat (listening on port 80) using the instructions
provided at
http://ex-parrot.com/~pete/tomcat-vhost.html
Based on the instructions here is what I have done..
1. Added the following to server.xml which is under under
$CATALINA_HOME/conf
<Host name="www.riz.com" appBase="webapps/riz"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
There is a riz.war file under $CATALINA_HOME/webapps that gets
expanded on deployment.
2. Created a directory $CATALINA_HOME/conf/Catalina/www.riz.com
Added ROOT.xml to this directory which contains
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="riz" docBase="" path=""
workDir="work/Catalina/riz/_">
</Context>
Note that I have mapped www.riz.com to 127.0.0.1 in the "hosts"
file
under c:\windows\system32\drivers\etc so that when i type
www.riz.com in
the browser it will resolve to localhost.
Please can someone tell me what I am doing wrong, or if I am
missing
anything?
Thanks,
-Riz.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]