tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <>
Subject Re: Hook into Tomcat before web applications load
Date Sun, 20 Mar 2011 11:06:25 GMT
Am Samstag, den 19.03.2011, 19:26 -0400 schrieb Pulkit Singhal:
> Hello,
> Is there a hook exposed in tomcat such that a custom class can be
> introduced to do some work at a point where we have a list of the
> docBase attribute for all the web applications that will be hosted by
> this tomcat instance ... while one of the web application specific
> handling has begun yet?
> I 'm asking this for any tomcat version, starting with 5.x, 6.x or 7.x
> ... I don't care.
> The motivation behind this question is a bit wordy so I don't want to
> take everyone off topic by posting it here ... but if you are
> interested in reading you can refer to this link:
There may be such a hook, but I don't think it would be a good idea to
use it for your usecase.

There are reasons why the web-app class loader and commons loader are
not the same. Only the developer can really decide if jar's can be

Take for example log4j. You will find it in many web-apps, but if you
try to put it into your common class loader, it will only be initialized
by the first web-app. The other web-apps will be able to use it, though.
But you will get strange results.

Any globally shared ressource, such as static variables or Singletons
will get you in trouble.

So: Don't do it.

> Thanks!
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message