You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bernd Koecke <bk...@schlund.de> on 2001/08/01 10:16:19 UTC

Re: How to get everyone to use one config

Brandon Cruz wrote:
> 
> I have a system set up on tomcat 3.2.1, linux, apache...
> 
> I have several virtual hosts that are all using the same web application.
> This application consists of a bunch of class files that are stored in
> $tomcat_home$/classes and packages stored in $tomcat_home$/lib.  I would
> like to be able to set up things in web.xml such as custom error pages and
> the like.  Is there a way I can make all these hosts use the same error
> pages?  I don't care if it looks the same across all sites when an error
> pops up.

You could use a symlink for this page, but then you have to write the
same text in all the web.xml-files. But you can write your own
ContextInterceptor and place it after the WebXmlReader. Then you can
configure your Interceptor to add the same error page to all or a group
of contexts.
> 
> On another note, what if I decide that I want to create a custom web
> application for just one of my virtual hosts?  Is this possible?  Can I just
> create it as I normally would for a web application?  If I have classes with
> the same name, will it find the ones in tomcat_home/classes or
> web-inf/classes first?

Yes its possible. Normally the Contexts are separated by each other.
Every Context gets his own ClassLoader which has the ClassLoader of
Tomcat as parent. The servlet is loaded by the classloader of the
context. So any class in your Servlet will ask the servlet classloader
first and this will call the parent classloader in a second try. So you
have to be carefull with new versions of your webapp. Otherwise you
could get errors like the foks with two parser in their classpath.

[...]

Hope this helps :)

Bernd
-- 
Dipl.-Inform. Bernd Koecke
UNIX-Entwicklung
Schlund+Partner AG
Fon: +49-721-91374-0
E-Mail: bk@schlund.de