On Jun 4, 2013, at 11:36 AM, Don Asper <don.as...@sas.com> wrote:

> I am considering using the Tomcat 7 shared classloader to reduce the memory 
> footprint of my web apps.  

IMHO, don't do this unless…

  1.) You are very, very sure what you are doing
  2.) You've analyzed the memory savings that you'll achieve by doing this and 
you are sure that it is significant compared to the cost of your time if you 
need to debug a problem.

> But, I'm afraid that loading my application jar files into a single 
> classloader will cause lots of problems.  I'm aware that the shared classpath 
> should not specify multiple versions of the same class.  But I suspect, for 
> example, that classes that have static properties must not be shared.  Am I 
> correct in thinking this?  Are there other problems that I should anticipate? 
>  Thanks!


In my experience, errors of this nature are typically subtle and difficult to 
debug, another reason why I'd recommend against this.  

My personal favorite error is the ClassCastExceptions that say something like 
"cannot cast classX to classX" that occurs when classX from one class loader is 
attempted to be cast to classX from another class loader.  There are others, 
you can probably find some more good examples by looking back through the list 
archives.

My advice is to follow the kiss principle and just put your JAR files in with 
your web application.

Dan



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to