Search code examples
tomcatgrailslibs

Multiple grails applications on Tomcat


I'm about to deploy several grails apps on top of a single Tomcat server, and I have the following doubts:

  1. In terms of memory usage: Does it make a difference to put the common grails libs under shared/lib instead of putting them in each app's war files? Is there a list of those jars ?
  2. If so, is there a mechanism not to package those jars in the war file for the "production" environment? I'm using NetBeans 6.7.
  3. I'm about to use Tomcat 5.5; are there any experiences that recommend to use 6.0 instead?

Thanks


Solution

  • I think best practices are to keep the libraries in the war, because if you update a library that's shared then you have make sure it's compatible with all of your apps that are using it. We do this with grails and with spring in general that way we don't have to go back and do compatibility testing each time we upgrade.

    Also I believe that tomcat loads an instance of the class per application so you don't save on memory by using it as a common class.

    See also:

    Does Tomcat load the same library file into memory twice if they are in two web apps?