Bug 63567 - catalina.sh fails to pass LOGGING_MANAGER to jvm during stop
Summary: catalina.sh fails to pass LOGGING_MANAGER to jvm during stop
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.41
Hardware: All Linux
: P2 normal (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-16 15:28 UTC by E Rempel
Modified: 2019-07-25 09:28 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description E Rempel 2019-07-16 15:28:21 UTC
If LOGGING_MANAGER is set (in setenv.sh) startup processing works correctly, but during shutdown (catalina.sh stop) a number of errors are logged regarding logging plugins failing to be created.

 main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.FileAppender for element File: java.lang.ClassCastException: org.apache.logging.log4j.core.appender.FileManager$FactoryData cannot be cast to org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData java.lang.ClassCastException: org.apache.logging.log4j.core.appender.FileManager$FactoryData cannot be cast to org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData

Adding the LOGGING_MANAGER to the eval of the java runtime in the "stop" case of catalina.sh resolves this.

Line 519 of catalina.sh

change

  eval "\"$_RUNJAVA\"" $JAVA_OPTS \
    -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
    -classpath "\"$CLASSPATH\"" \
    -Dcatalina.base="\"$CATALINA_BASE\"" \
    -Dcatalina.home="\"$CATALINA_HOME\"" \
    -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
    org.apache.catalina.startup.Bootstrap "$@" stop


to

  eval "\"$_RUNJAVA\"" $LOGGING_MANAGER $JAVA_OPTS \
    -D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
    -classpath "\"$CLASSPATH\"" \
    -Dcatalina.base="\"$CATALINA_BASE\"" \
    -Dcatalina.home="\"$CATALINA_HOME\"" \
    -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
    org.apache.catalina.startup.Bootstrap "$@" stop
Comment 1 Mark Thomas 2019-07-24 21:36:27 UTC
This was removed because it was causing issues with Java 9:
https://github.com/apache/tomcat/commit/ff57a28661ee6e581dff17e362864910efed426b

There is also the point of multiple processes trying to write to the same file.
Comment 2 Mark Thomas 2019-07-24 21:42:22 UTC
Given the timing of the fix mention in comment #1 (2 years before Java 9 GA) that issue looks like an issue in the EA releases that was addressed by GA. On that basis, restoring the $LOGGING_MANAGER looks like the best course of action here.
Comment 3 Mark Thomas 2019-07-25 09:28:34 UTC
Fixed in:
- master for 9.0.23 onwards
- 8.5.x for 8.5.44 onwards

7.0.x was not affected.