I tried to install Cocoon-Lenya within Tomcat. Cocoon needs some updated XML libraries to replace the Java JDK ones (I use Sun-JDK 1.4.2_03). So I placed the file (xalan-2.5.0.jar to be specific) in the /opt/tomcat/common/endorsed directory. I then found out that this lib never gets used. Looking at the output of "ps aux" after starting Tomcat shows: /opt/sun-jdk-1.4.2.03/bin/java -Djava.endorsed.dirs= -classpath /opt/sun-jdk-1.4.2.03/lib/tools.jar:/opt/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start The important part is that java.endorsed.dirs is empty. I then checked the /opt/tomcat/bin/setclasspath.sh file which contains the following lines: # Set the default -Djava.endorsed.dirs argument JAVA_ENDORSED_DIRS="$TOMCAT_LIBDIR" I put an "echo $TOMCAT_LIBDIR" in which gave me an empty string. I then directly put the "/opt/tomcat/common/endorsed" directory in, which leads to another bug, which I filed seperatly (Tomcat 4.1.24-r1 crashes on start when setting endorsed libs directory) Nevertheless putting my "xalan-2.5.0.jar" file in a temporary directory and pointing JAVA_ENDORSED_DIRS to that directory leads to the expected results of that file getting used and Cocoon working. Reproducible: Always Steps to Reproduce: 1. Start Tomcat 2. Check "ps aux" -> java.endorsed.dirs is empty Actual Results: java.endorsed.dirs did not get set to "/opt/tomcat/common/endorsed" Expected Results: Set java.endorsed.dirs to "/opt/tomcat/common/endorsed" $TOMCAT_LIBDIR should point to "/opt/tomcat/common/endorsed" Gentoo Base System version 1.4.3.11 Portage 2.0.49-r20 (default-x86-1.4, gcc-3.3.1, glibc-2.3.2-r9, 2.4.22-gentoo-test-r0) ================================================================= System uname: 2.4.22-gentoo-test-r0 i686 Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=pentium3 -O3 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /opt/tomcat/conf /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-march=pentium3 -O3 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X alsa apm arts avi berkdb crypt cups encode esd foomaticdb gdbm gif gnome gpm gtk gtk2 imlib jpeg kde libg++ libwww mad mikmod mmx motif mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl png python qt quicktime readline sdl slang spell ssl svga tcpd truetype x86 xml2 xmms xv zlib"
I looked a little more into it. There is a variable called CATALINA_LIBDIR in /etc/conf.d/tomcat which points to the correct tomcat endorsed libdir. So to fix this bug the TOMCAT_LIBDIR variable in the gentoo.diff has to be renamed to CATALINA_LIBDIR.
You don't want to put your JARs in common/endorsed. They should be placed in the WEB-INF/lib dir of your webapp (cocoon). If that doesn't work you should try, in order, placing it in shared/lib and common/lib. Refer to the classloader howto here: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
Fixed in 4.1.29 and 5.0