> From: Tom Jones [mailto:tjo...@acworld.com]
> Subject: Tomcat Configuration Help
> 
> I'm totally new to Tomcat and I have been searching the net for a
> little while now looking for info on configuring tomcat to host
> multiple apps on different ports and different web roots.

Other than not telling us the Tomcat version you're using (along with the JVM 
and platform), you've done a pretty good job of explaining the situation.

If you don't need to isolate the applications by port (that's quite unusual), 
you can simplify things a bit by using virtual hosting:
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

> I have come across some posts on running multiple instances 
> which might be the right thing for me I'm still not sure.

Multiple instances are not strictly necessary, but might be easier to 
administer, and will obviously avoid undesired interaction between the two 
webapps.

> tomcat
> - webapps
> -- appWebServices
> -- appMainUserSite

That's not good.  Each <Host> should have its own appBase; by sharing them, 
you've made both apps available on both hosts.

> I would like to run the app "appWebServices" on port 3100 with the
> docBase to be "tomcat/webapps/appWebServices". I would also like the
> app to support 500 simultaneous connections. Now I would like to run
> the app "appMainUserSite" on port 3200 with the docBase to be
> "tomcat/webapps/appMainUserSite". I would also like the app to support
> 100 simultaneous connections.

As you surmised, you will need separate <Service> elements if you want to 
segregate the apps by port number.

> <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"

You might want to use a unique namePrefix for each <Executor> so you can more 
easily tell them apart in a thread dump (should that ever be necessary).

> <Connector executor="tomcatThreadPool" port="3100"
> redirectPort="3144"

If you don't have a <Connector> for port 3144, why do have a redirectPort?  
Also be aware that many versions of IE don't handle HTTPS over anything other 
than port 443.

> <Host name="localhost" appBase="webapps" 

The appBase should be unique for each <Host>.

> <Context path="" docBase="appWebServices"/>

This is bad; do not put <Context> elements in server.xml.  Your webapp should 
be located in this <Host>'s appBase directory, and named ROOT (case-sensitive, 
even on Windows).  What you have now got you double deployment, once as the 
default webapp and once more as appWebServices - confusing at best.  The 
<Context> element, if you need one at all - and you don't, in this situation - 
should be in the webapp's META-INF/context.xml file, in other words:

    [appBase]/ROOT/META-INF/context.xml

and must not include path or docBase attributes.

> <Executor name="mySiteThreadPool" namePrefix="catalina-exec-"

See namePrefix comment above.

> <Host name="localhost" appBase="webapps"

See appBase comment above.

> <Context path="" docBase="appMainUserSite" />

See <Context> comment above.

 - 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.

Reply via email to