After ugrading Java to JDK 11, Jenkins fails to start due to Unrecognized VM option

Issue

  • After upgrading to JDK 11, Operations Center and/or Controllers fail to start with an issue like the following:

    Unrecognized VM option '<JVM OPTION>'
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    

Environment

Explanation

Java 11 (and mainly Java 9) removes support for many Java options:

When upgrading from Java 8 to Java 9+, unsupported and deprecated options must be removed and if possible replaced.

Note: See CloudBees Supported Java Version for information about Java Versions support.

Resolution

Many of the previously recommended JDK 8 GC logging arguments are no longer supported:

  • -Xloggc:${PATH}/gc.log / -Xloggc:${PATH}/gc-%t.log
  • -XX:NumberOfGCLogFiles=2
  • -XX:+UseGCLogFileRotation
  • -XX:GCLogFileSize=100m
  • -XX:+PrintGC
  • -XX:+PrintGCDateStamps
  • -XX:+PrintGCDetails
  • -XX:+PrintHeapAtGC
  • -XX:+PrintGCCause
  • -XX:+PrintTenuringDistribution
  • -XX:+PrintReferenceGC
  • -XX:+PrintAdaptiveSizePolicy

They must be replaced by the single -Xlog argument as documented in Prepare Jenkins for support:

  • -Xlog:gc*=info,gc+heap=debug,gc+ref*=debug,gc+ergo*=trace,gc+age*=trace:file=${PATH}/gc.log:utctime,pid,level,tags:filecount=2,filesize=100M

Where:

  • filecount=2 is the equivalent of the deprecated -XX:NumberOfGCLogFiles=2
  • filesize=100M is the equivalent of the deprecated -XX:GCLogFileSize=100m
  • file=${PATH}/gc.log / file=${PATH}/gc-%t.log is the equivalent of the deprecated -Xloggc:${PATH}/gc.log / -Xloggc:${PATH}/gc-%t.log

See also Java 11: Convert GC Logging Flags to Xlog and Java 11: Enable Logging with the JVM Unified Logging Framework for more details.

*Note: If the unsupported arguments is not among the one listed above, have a look at the following documentations to understand if it may simply be removed or what it may be replaced with:

Have more questions?

0 Comments

Please sign in to leave a comment.