Results 1 to 3 of 3

Thread: Placement of jars on Tomcat

  1. #1
    Join Date
    Aug 2004
    Location
    Stockholm
    Posts
    466

    Default 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,
    Sincerely,
    /The Cantor

    "Murphy was an optimist"
    (The O'Toole commentary on Murphy's Law)

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    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.
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    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.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

Similar Threads

  1. Spring + Quartz + Tomcat = no shutdown
    By ahumphr in forum Container
    Replies: 7
    Last Post: Jul 5th, 2011, 11:45 AM
  2. Problems using Burlap JMX in Tomcat
    By mryan in forum Management
    Replies: 1
    Last Post: Sep 30th, 2005, 02:43 AM
  3. Replies: 4
    Last Post: Jun 15th, 2005, 04:47 PM
  4. Tomcat [ERROR] SchemaExecute update
    By scraly in forum Web
    Replies: 0
    Last Post: Apr 26th, 2005, 02:59 AM
  5. Replies: 1
    Last Post: Mar 9th, 2005, 04:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •