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

Article ID:4569312535195
2 minute readKnowledge base

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.

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.

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:${LOGDIR}/gc.log / -Xloggc:${LOGDIR}/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 CloudBees CI for Support:

  • -Xlog:gc*=info,gc+heap=debug,gc+ref*=debug,gc+ergo*=trace,gc+age*=trace:file=${LOGDIR}/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=${LOGDIR}/gc.log / file=${LOGDIR}/gc-%t.log is the equivalent of the deprecated -Xloggc:${LOGDIR}/gc.log / -Xloggc:${LOGDIR}/gc-%t.log

  • ${LOGDIR} is an existing directory where operations center or controller can write log files, e.g. /var/log/cloudbees-core-cm

*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: