On 1/20/2013 7:34 AM, Caldarale, Charles R wrote:
From: Narahari 'n' Savitha [mailto:savith...@gmail.com] Subject:
Class loaders line confusion, please help

What is the diff between common.loader or shared.loader

What should be put on which line.

What is the right approach ?

Don't change either; the shared loader is a left-over from previous
versions of Tomcat, and the common loader already has a properly
defined set of search locations.  Put your classes where they belong,
which is usually with each webapp.  Classes that must be visible to
Tomcat are placed in Tomcat's lib directory.  Sharing classes across
webapps is a really, really bad idea.

- Chuck


+1

Narahari,

As was discussed in your previous thread, this is a really bad idea. You will probably not get a different answer by asking the same question in a different manner.

From your previous thread, my understanding of the problem is as follows.

1. You have many jars

You don't want to pollute the Tomcat lib directory, because for you this makes upgrading more difficult. The only way I can see this makes upgrading more difficult is if you upgrade 'in place'. Upgrading 'in place' is a spectacularly bad idea.

2. You have PermGen issues

I don't know if you do not have enough PermGen space or if you have PermGen leaks. PermGen leaks show up when you reload web applications multiple times and then run out of PermGen space.

If it's the first, then increase PermGen space.

If it's the latter, fix your libraries. There are many articles on the web detailing what PermGen leaks are, how to find them, and how to avoid them.

If you cannot fix the libraries, then here's an alternate solution.

A. Read RUNNING.txt, the advanced section on running multiple Tomcats
B. Set up a $CATALINA_HOME (pristine Tomcat from tomcat.apache.org)
C. Set up a $CATALINA_BASE (where you run your Tomcat from)
D. Add all of your jars to $CATALINA_BASE/lib
   a. Those will be the only jars in that directory
   b. Everything else will be read from $CATALINA_HOME
E. Set up setenv.sh (setenv.bat on Windows)
   a. Set $CATALINA_HOME to point to $CATALINA_HOME
   b. Set $CATALINA_BASE to point to $CATALINA_BASE
F. Write your startup / shutdown scripts accordingly
   a. Set $CATALINA_HOME, $CATALINA_BASE in your environment
   b. Run $CATALINA_HOME/bin/startup.sh (startup.bat)
   c. Or write custom scripts to call startup.sh (startup.bat)
   d. Or use commons-daemon

You will end up with a Tomcat that shares all of your problem libraries without adding those libraries to a pristine Tomcat installation.

As Chuck, many others, and the documentation inside RUNNING.txt all point out, this is a really bad practice. The only jars that should added in this fashion are things like JDBC drivers and other JNDI resources.

. . . . just my two cents.
/mde/

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

Reply via email to