The tomcat startup script /usr/share/tomcat-5/bin/catalina.sh unconditionally sources /etc/conf.d/tomcat-5 even when called from a linked service startup script such as /etc/init.d/tomcat-dev (which is a link from /etc/init.d/tomcat-5). The prototype variables in /etc/conf.d/tomcat-5 don't allow for the profiles to have separate log directories. /etc/conf.d/tomcat-5 has an extraneous line that erases the log4j setup. Reproducible: Always Steps to Reproduce: 1. cd /etc/init.d; ln -s tomcat-5 tomcat-dev 2. cp /etc/conf.d/tomcat-5 /etc/conf.d/tomcat-dev 3. In /etc/conf.d/tomcat-dev, change PROFILE to dev 4. Duplicate /var/lib/tomcat-5/default to /var/lib/tomcat-5/dev (make dirs /var/{run,tmp}/tomcat-5/dev and /etc/tomcat-5/dev and create the symlinks in /var/lib/tomcat-5/dev). 5. /etc/init.d/tomcat-dev start Actual Results: The scripts used /etc/conf.d/tomcat-5 to get the config variables. PROFILE was still set to default. log4j doesn't initializae properly, reports errors in /var/log/tomcat-5/catalina.log. Expected Results: The config variables in /etc/conf.d/tomcat-dev should have been used and the PROFILE set to dev. Logging creates files under /var/log/tomcat-5/${PROFILE}. log4j is initialized and produces log output for configured services. Suggestions for a fix: --- /usr/share/tomcat-5/bin/catalina.sh 2005-11-14 10:49:37.765565500 -0700 +++ /tmp/usr/share/tomcat-5/bin/catalina.sh 2005-11-14 10:42:47.591931000 -0700 @@ -40,7 +40,24 @@ # source the appropriate files right away source /etc/profile -source /etc/conf.d/tomcat-5 +if [[ ! -r "/etc/conf.d/${SVCNAME}" ]]; then + # STDOUT output gets swallowed by the environment + # that start-stop-daemon sets up, so try syslog and + # then logging to a file + logger=$(which logger) + if [[ ! -z "$logger" ]]; then + $logger -t ${SVCNAME} -p daemon.err \ + "${SVCNAME} missing configuration file /etc/conf.d/${SVCNAME}" + exit 1 + fi + if [[ -d /var/log/tomcat-5/ ]]; then + echo "${SVCNAME} missing configuration file /etc/conf.d/${SVCNAME}" \ + >> /var/log/tomcat-5/${SVCNAME}.log + fi + exit 1 +else + source /etc/conf.d/${SVCNAME} +fi # OS specific support. $var _must_ be set to either true or false. cygwin=false --- /etc/conf.d/tomcat-5 2005-11-14 10:58:57.516008500 -0700 +++ /tmp/etc/conf.d/tomcat-5 2005-11-14 11:02:08.287931000 -0700 @@ -50,8 +50,9 @@ # (Optional) Java runtime options used when the "start", "stop", or "run" # commands are executed. -CATALINA_OPTS="-Dlog4j.configuration=file:/etc/tomcat-5/log4j.properties" -CATALINA_OPTS="-Dbuild.compiler.emacs=true" +CATALINA_OPTS="-Dlog4j.configuration=file:/etc/tomcat-5/${PROFILE}/log4j.properties" +# This overrides the previous previous setting +##CATALINA_OPTS="-Dbuild.compiler.emacs=true" # Java Platform Debugger Architecture (JPDA) # http://java.sun.com/products/jpda/
The duplicate CATALINA_OPTS line /etc/conf.d/tomcat-5 is porbably because of the jikes use flag. The comments related to the JSP servlet in /var/lib/tomcat-5/default/conf/web.xml (line 179) say to add the value -Dbuild.compiler.emacs=true to CATALINA_OPTS when using jikes. So the line in web.xml should be: CATALINA_OPTS="${CATALINA_OPS} -Dbuild.compiler.emacs=true" instead of: CATALINA_OPTS="-Dbuild.compiler.emacs=true" [ebuild R ] www-servers/tomcat-5.0.28-r9 +doc +examples +jikes 0 kB
Profiling will be removed soon. It was an experimental feature never added to stable versions of Tomcat in portage. Profiling has been removed from 5.5.16 in java experimental. I will see about removing from 5.0.x versions as well. Also we are no longer using catalina.sh to start/stop tomcat. Nor are we patching or modifying that file.
Tomcat 5.0.x is very old now, and upstream (Tomcat Devs) highly recommend against anyone installing or using this version. Please use Tomcat 5.5.x in java-experimental overlay. http://www.gentoo.org/proj/en/java/experimental.xml Tomcat 5.0.x ebuilds will be masked soon and eventually removed all together. Tomcat 5.5.x should be added to portage within a month or so. Just after migration to new java system is complete.
This should be taken care of by tomcat-5.5.17 which I just added. Give it a few hours to get to your local mirror, and emerge --sync.