-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joe,

On 5/4/2010 1:26 PM, Joe Hansen wrote:
> I have written two web applications abc and xyz. I have mapped
> abc.local and xyz.local to my machine's IP Address in my Windows HOST
> file. So when I visit http://abc.local, I would want the abc web
> application to be accessed. When I visit http://xyz.local, I would
> want the xyz web application to be accessed. This is what I have been
> trying to achieve. Apparently I have been doing this the wrong way.
> Looks like I have some reading to do! Will post back after I read some
> Tomcat documentation.

You want this:

webapps/abc
webapps/abc/ROOT  <-- this is your "abc" webapp
webapps/abc/ROOT/META-INF
webapps/abc/ROOT/META-INF/context.xml
webapps/xyz
webapps/xyz/ROOT <-- this is your "xyz" webapp
webapps/xyz/ROOT/META-INF
webapps/xyz/ROOT/META-INF/context.xml

It looks like you don't have any custom configuration for your
<Context>, so you don't even need META-INF/context.xml files for either
of your webapps.

Set up two <Host>s:

<Engine defaultHost="abc">
  <Host name="abc" appBase="webapps/abc" autoDeploy="true">
    <Alias>abc.local</Alias>
  </Host>

  <Host name="xyz" appBase="webapps/xyz" autoDeploy="true">
    <Alias>xyz.local</Alias>
  </Host>
</Engine>

Many administrators would expect that CATALINA_BASE/webapps is the
auto-deployment directory for a standard setup, so maybe instead of the
above paths, you'd want to move "webapps/xyz" and "webapps/abc" outside
of CATALINA_BASE, and then refer to them appropriately from within
server.xml.

This should avoid double-deployment.

Basically, these are the best-practices for Tomcat configuration:

1. Never declare <Context> elements in server.xml
2. Use the default auto-deploy <Host> and put your webapps into the
appBase directory... remember to use ROOT as appropriately
3. If you don't want your webapps to be in the auto-deploy directory,
then use conf/[Service]/[Engine]/[webappname].xml to configure your
webapps instead.

Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvgfKwACgkQ9CaO5/Lv0PBj4wCfaCKJ2cQUT7a9kC6rzdIVcho5
pGUAnioMCN5xtZD7bYPHV+5AdCRCKaX0
=6FLu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to