Unrecognized JVM GC options when using JAVA 11
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When using Java 11, some JVM parameters previously applied to Tomcat are now unrecognized.
Environment
- Confluence
- Java 11 / OpenJDK 11
Diagnosis
When using Java 11 with Confluence, if you still have JVM options from a previous Java 8 installation you may find the application will not start and the following or similar messages are printed in the logs:
Unrecognized VM option 'UseGCLogFileRotation'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Cause
In Java 11 some JVM flags including those used in Java 8 for Garbage Collection Logging have been removed.
If these are still contained in the JVM flags specified in the setenv.sh or setenv.bat the JVM will not be able to start.
It's known that the following options are unrecognized in Java 11:
- -d64
- PrintGCTimeStamps
- PrintGCDateStamps
- PrintTenuringDistribution
- PrintGCCause
- PrintGCDetails
- UseGCLogFileRotation
- NumberOfGCLogFiles
- GCLogFileSize
In Java 11, these GCLog options are now handled by Xlog, there is a conversion table below:
More information about this change can be found in the following Stackoverflow article:
Solution
Either add the following JVM option to the setenv.sh or setenv.bat file (option 1), or convert the GC options to the new Xlog format (option 2). For option 2, be sure to remove the unrecognized options for Java 11 from the list above.
XX:+IgnoreUnrecognizedVMOptions
CATALINA_OPTS="-Xlog:gc*:file=$LOGBASEABS/logs/gc-%t.log:tags,time,uptime,level:filecount=5,filesize=2M ${CATALINA_OPTS}"