Order of Tomcat Classloaders: common, shared, and server

前端 未结 3 680
南笙
南笙 2021-02-07 08:33

The Tomcat Class Loader HOW-TO documentation describes 4 different class loaders:

  1. Bootstrap
  2. System
  3. Common
  4. Webapp

In the d

3条回答
  •  情深已故
    2021-02-07 08:47

    Strange, Tomcat 5.5 classloader doc still has the shared loader documented but 6.0 doesn't; neither has v7.0 which you quote. Maybe they're going to deprecate it?

    We do use shared loader extensively to override existing classes that came with the vanilla version of our software. The software we make comes in releases and to make a complete new release for one customer (which, say, requires a critical bugfix) is too expensive (re-testing everything, rebuilding, providing new documentation, new version number, etc.). So what we do instead is we provide a "hotfix" which goes into shared loader and overrides relevant .class in webapp.

    Most often, "hotfix" is just a single class so the overall regression risk is minimal.

    When our software gets upgraded, the upgrade removes the "hotfix" as the corrected code will also be present in the next version of our software itself.

    I can also imagine other people using shared classloader for something that spawns across many different webapps.

提交回复
热议问题