You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shanti Suresh <sh...@umich.edu> on 2012/04/30 21:28:46 UTC

Multiple Contexts - one classloader

All,

Is there a way to specify with Tomcat 7, one webapp-base with multiple contexts?  If I create several XML files under <tomcat-home>/conf/Catalina/localhost/ and point the docbase to outside-appbase WAR path I get multiple classloaders.  I would like one application instance to serve the different contexts.  Is that possible?  An example of three context XML files follows.  But I get three classloaders and multiple deployments:

siteA.xml:

<Context docBase="/opt/tomcat/killerApp" path="/siteA" crossContext="true"
         clearReferencesHttpClientKeepAliveThread="true"
         clearReferencesStopTimerThreads="true"
         swallowOutput="true" />


siteB.xml:

<Context docBase="/opt/tomcat/killerApp" path="/siteB" crossContext="true"
         clearReferencesHttpClientKeepAliveThread="true"
         clearReferencesStopTimerThreads="true"
         swallowOutput="true" />


siteC.xml:

<Context docBase="/opt/tomcat/killerApp" path="/siteC" crossContext="true"
         clearReferencesHttpClientKeepAliveThread="true"
         clearReferencesStopTimerThreads="true"
         swallowOutput="true" />

Thanks.

                     -Shanti





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


RE: Multiple Contexts - one classloader

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Shanti Suresh [mailto:shanti@umich.edu] 
> Subject: Multiple Contexts - one classloader

> I would like one application instance to serve the different contexts.

Please read the servlet spec; one application == one context.  You can play games with forwarding if you want, or simply install just one webapp as ROOT (case sensitive) and remove the three site* <Context> elements.

> I get three classloaders and multiple deployments:

As you should.  Each webapp is independent of the others, by definition.

Also, take out the path attributes in the three <Context> elements; that attribute is not allowed here.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Multiple Contexts - one classloader

Posted by Pid <pi...@pidster.com>.
On 30/04/2012 20:28, Shanti Suresh wrote:
> All,
> 
> Is there a way to specify with Tomcat 7, one webapp-base with multiple contexts?

I may regret asking: why do you want do this?


p

> If I create several XML files under <tomcat-home>/conf/Catalina/localhost/ and point the docbase to outside-appbase WAR path I get multiple classloaders.  I would like one application instance to serve the different contexts.  Is that possible?  An example of three context XML files follows.  But I get three classloaders and multiple deployments:
> 
> siteA.xml:
> 
> <Context docBase="/opt/tomcat/killerApp" path="/siteA" crossContext="true"
>          clearReferencesHttpClientKeepAliveThread="true"
>          clearReferencesStopTimerThreads="true"
>          swallowOutput="true" />
> 
> 
> siteB.xml:
> 
> <Context docBase="/opt/tomcat/killerApp" path="/siteB" crossContext="true"
>          clearReferencesHttpClientKeepAliveThread="true"
>          clearReferencesStopTimerThreads="true"
>          swallowOutput="true" />
> 
> 
> siteC.xml:
> 
> <Context docBase="/opt/tomcat/killerApp" path="/siteC" crossContext="true"
>          clearReferencesHttpClientKeepAliveThread="true"
>          clearReferencesStopTimerThreads="true"
>          swallowOutput="true" />
> 
> Thanks.
> 
>                      -Shanti
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


-- 

[key:62590808]