Announcement Announcement Module
Collapse
No announcement yet.
Placement of jars on Tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Placement of jars on Tomcat

    Hi.

    I've been wondering a lot about the Spring distribution.
    Tomcat (4.1.x) is as we all know a bit excentric about classloading etc.
    Beeing a "good boy" I always place every jar needed for an application inside /WEB-INF/lib, but I wonder;
    1) Is there a working way of placing the spring-jars on for example /commons/lib or something like that?
    2) Does the repetition of spring jars in every app deployed on one Tomcat instance mean that RAM is consumed in vain? Could resources be saved by centralizing the spring jars?

    Thanks,

  • #2
    There's a document that's part of the TomCat docs which shows the classloader hierarchy in TomCat. Generally, you should be able to put Spring libs in a shared classloader that all the webapp classloaders will be a child of. If you do this with a lib that doesn't use the context classloader it's problematic, as it won't see classes which are in a classloader farther down, but this is not an issue for Spring, which will always try to use the context classloader.

    As for memory usage, yes, you would save on reloading the same class files, but you'd have to do some profiling to see how much difference this really makes.

    Comment


    • #3
      Yes, you can share JARs in Tomcat. I've done it for a client with unusual requirements. We shared Spring JARs, a shared security library and one level of XML context definition that set up consistent security interception. However, I'm not sure it's a best practice.

      Comment

      Working...
      X