++ This bug is a clone of bug 899457 ++ Steps to Reproduce: 1) Edit /etc/tomcat6/tomcat6.conf and add: JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" 2) run "service tomcat6 start" 3) Look at /var/log/tomcat6/catalina.out, and see that it has failed to start because the debug options have been specified twice This can be seen more clearly by editing /usr/sbin/tomcat6 to print out the command it is about to execute. Workaround Description: Remove the following lines from /usr/sbin/tomcat6 {code} # Get the tomcat config (use this for environment specific settings) if [ -z "${TOMCAT_CFG}" ]; then TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" fi if [ -r "$TOMCAT_CFG" ]; then . $TOMCAT_CFG fi {code} project_key: JBEWS JVM options can be added to JAVA_OPTS in /etc/sysconfig/tomcat6 or /etc/tomcat6/tomcat6.conf (the former per service the latter global). When JAVA_OPTS are added to /etc/tomcat6/tomcat6.conf, they get appended to the command line twice, which can cause problems if specifying the option twice does not have the same effect as specifying it once.
Adding JAVA_OPTS in /etc/sysconfig/tomcat6 works correctly, adding it once
This is because the following fragment is in both /etc/init.d/tomcat6 and /usr/sbin/tomcat6, so it is executed once by the service wrapper, which then calls the latter script and that runs the configuration file again. TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" if [ -r "$TOMCAT_CFG" ]; then . $TOMCAT_CFG fi A simple fix would be to drop that section from /etc/init.d/tomcat6. However that means that the global configuration there overrides the per-service configuration in /etc/sysconfig/${NAME}, which is almost certainly the wrong way around. If it was dropped from /usr/sbin/tomcat6, then it would mean the no configuration file is read if someone starts tomcat6 outside the service wrapper.
Assigning to Dave.
This will be fixed as recent cves are applied to the tomcat6 builds over the week of 7/18.
The problem occurs because /usr/sbin/tomcat6 redundantly sources tomcat6.conf. The diffs below show the solution being tested. {code:title=/usr/sbin/tomcat6} RCS file: /cvs/dist/rpms/tomcat6/RHEL-4-EP-5/tomcat6-6.0.wrapper,v retrieving revision 1.4 diff -r1.4 tomcat6-6.0.wrapper 10,22d9 < LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties" < < # Get the tomcat config (use this for environment specific settings) < if [ -z "${TOMCAT_CFG}" ]; then < TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" < fi < < if [ -r "$TOMCAT_CFG" ]; then < . $TOMCAT_CFG < fi < < JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" < {code} {code:title=tomcat6.conf} RCS file: /cvs/dist/rpms/tomcat6/RHEL-4-EP-5/tomcat6-6.0.conf,v retrieving revision 1.4 diff -r1.4 tomcat6-6.0.conf 30a31,34 > LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties" > > JAVA_OPTS="${JAVA_OPTS} -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" > {code}
Additional consideration of cases when sbin/tomcat6 is used directly, here is new diff for sbin/tomcat6. The caller must define $NAME at least. RCS file: /cvs/dist/rpms/tomcat6/RHEL-4-EP-5/tomcat6-6.0.wrapper,v retrieving revision 1.4 diff -r1.4 tomcat6-6.0.wrapper 10,18c10,23 < LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties" < < # Get the tomcat config (use this for environment specific settings) < if [ -z "${TOMCAT_CFG}" ]; then < TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" < fi < < if [ -r "$TOMCAT_CFG" ]; then < . $TOMCAT_CFG --- > # The wrapper can't be used by itself. The NAME variable must be set by > # the caller. The first argument in the command line must be one of > # "start, stop, start-security, or version" > > if [ "$2" == "stand-alone" ]; then > if [ -z "${TOMCAT_CFG}" ]; then > TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" > fi > if [ -r "${TOMCAT_CFG}" ]; then > . ${TOMCAT_CFG} > fi > if [ -r "/etc/sysconfig/${NAME}" ]; then > . /etc/sysconfig/${NAME} > fi 21,22d25 < JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" < {code}
Sorry about the spam. After testing the changes, they became increasingly kludgey. The tomcat wrapper (sbin/tomcat6) was not intended to be called alone, and shouldn't source the config files. Instructions for creating additional service instances are in /etc/sysconfig/tomcat6. The block that read tomcat6.conf in sbin/tomcat6 will be removed completely.
fixed in tomcat6-6.0.32-18_patch_04.ep5.el4
Workaround Description: Added: Remove the following lines from /usr/sbin/tomcat6 {code} # Get the tomcat config (use this for environment specific settings) if [ -z "${TOMCAT_CFG}" ]; then TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" fi if [ -r "$TOMCAT_CFG" ]; then . $TOMCAT_CFG fi {code}
Release Notes Text: Added: /usr/sbin/tomcat6 no longer sources tomcat6.conf
Release Notes Text: Removed: /usr/sbin/tomcat6 no longer sources tomcat6.conf Docs QE Status: Removed: NEW