You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Wu Yiqun <yq...@mail.etonenet.com> on 2002/09/25 06:30:31 UTC
Classloader question in Tomcat 4.1.x
Hello:
I have some web application using commons-digester and common-dbcp. When I upgrade from
tc 4.0->tc 4.1.12, I found there are some jar in common/lib and server/lib. From the Class Loader Howto,
it is assumed following class search order:
/WEB-INF/classes of your web application
/WEB-INF/lib/*.jar of your web application
Bootstrap classes of your JVM
System class loader classses (described above)
$CATALINA_HOME/common/classes
$CATALINA_HOME/common/endorsed/*.jar
$CATALINA_HOME/common/lib/*.jar
$CATALINA_HOME/shared/classes
$CATALINA_HOME/shared/lib/*.jar
Now in common/lib there are commons-collections.jar, commons-dbcp.jar, commons-logging-api.jar,
commons-pool.jar. In server/lib there are commons-beanutils.jar and commons-digester.jar.
I have tried following method.
1. If in every /WEB-INF/lib has a copy of commons-digester and commons-beanutils.jar, then everything seems OK.
2. If delete all commons-digester and commons-beanutils.jar in /WEB-INF/lib and copy to common/lib, then tomcat
report java.lang.ClassNotFoundException: org.apache.catalina.core.StandardServer.
3. If delete all commons-digester and commons-beanutils.jar in /WEB-INF/lib and copy to shared/lib according to
Howto, then tomcat report an user class not found (cause it is created by digester).
4. If move commons-digester, commons-beanutils.jar + emp.jar(a user lib), log4j, jakarta-oro.jar to shared/lib,
then tomcat report strange error java.lang.ClassCastException: etonenet.db.PoolDataSource (a user class)
5. If using $CATALINE_BASE variable, the jar in $CATALINA_HOME/shared/lib is not included, is this a bug or
expected result?
Some background info:
OS: Redhat 7.3
JDK: Sun JDK 1.3.1_04
Servlet Engine: Tomcat 4.1.12 standalone mode
DB: mysql
I have 4 webapps, every application uses a common user lib emp.jar(which wrap log4j1.2 and
commons-dbcp + commons-digester). I want to put those common used jar to a common place instead
of distribute them in every /WEB-INF/lib. Thanks and please give me some hint on this problem.
E-Mail: yqwu@mail.etonenet.com
Http://www.etonenet.com