Migrate to Java 11

7 minute read

Java 11 was released on September 25, 2018 as a long-term support (LTS) version. The Jenkins LTS core that CloudBees CI is based on has been capable of using Java 11 for some time, but all core and plugin code was limited to using only Java 8 language features (Java 8 byte code). As of 2.357.x, CloudBees CI no longer supports Java 8. Because CloudBees CI is based on the Jenkins LTS, future releases of CloudBees CI will have the same requirement.

CloudBees has validated the core functionality and all plugins in the CloudBees Assurance Program work correctly when using Java 11. Plugins that are not part of the CloudBees Assurance Program may work, but they have not been verified and may cause issues.

CloudBees strongly recommends upgrading CloudBees CI on traditional platforms to Java 11 as soon as possible. Starting in release 2.332.1.4, CloudBees CI supports both Java 8 and Java 11 until the Jenkins community releases an LTS that requires Java 11.

Upgrading CloudBees CI Java Version From 8 to 11

Supported configurations

CloudBees performs full test flows with the following supported JDKs or JREs:

  • OpenJDK JDK/JRE 8 - 64 bits

  • OpenJDK JDK/JRE 11 - 64 bits

CloudBees CI versions prior to 2.332.1.4*

Table 1. CloudBees CI versions prior to 2.332.1.4
Component Supported Java version

Operations center

Java 8

Controller and agents

Java 8

Operations center shared agents

Java 8

CloudBees CI version 2.332.1.4*

Table 2. CloudBees CI version 2.332.1.4
Component Supported Java version

Operations center

Java 8 and Java 11

Controller and agents

Java 8 and Java 11

Operations center shared agents

Java 8 and Java 11

CloudBees CI version 2.361.1.2

Table 3. CloudBees CI 2.361.1.2
Component Supported Java version

Operations center

Java 11

Controller and agents

Java 11

Operations center shared agents

Java 11

As of 2.357.x, CloudBees CI no longer supports Java 8. However, older fixed line releases continue to support Java 8 until the end of their support windows. CloudBees strongly recommends you update your environment to run on Java 11 to avoid issues with future upgrades.

Action required

CloudBees began supporting mixed-mode JVM usage beginning in the March 2022 release (version 2.332.1.4) and continued to support it until the September 2022 release (version 2.361.1.2), allowing you to transition into a supported version of Java without impacting CloudBees CI operations. CloudBees supports the operations center running Java 11, with controllers running Java 8 or 11 only. Agents must be on the same JVM version as their controller.

Customers who use RPM, WAR, or Windows MSI installation files may continue to run Java 8 on versions up to and including the 2.332.1.4 release. However, as this is expected to be the last release that will support Java 8, we urge customers to start migrating to Java 11 environments before it becomes a requirement in version 2.361.1.2.

The CloudBees CI Docker images are built with Java 11 by default. If you use custom build agents, you must ensure that they are upgraded to use Java 11.

You should first update any operations center instances to Java 11 before upgrading controllers and agents. After the operations center has been updated, you can begin to upgrade each controller and its associated agents while operating in a mixed JVM environment.

CloudBees will not support mixed JVM usage in the CloudBees Jenkins Platform fixed line releases. CloudBees anticipates the fixed lines will move to Java 11 in the next year. Customers running in fixed line environments will be required to upgrade their environments to Java 11 when they upgrade to the release that has native support for Java 11.

Starting with version 2.361.1.2, Java 11 is required and mixed-mode JVM usage is no longer supported.

Upgrading the JVM used to run CloudBees CI

You should keep the following things in mind when upgrading the JVM used to run CloudBees CI.

Operations center instances must be updated to use Java 11 before you can update controllers and their agents. Failure to do so may result in the loss of connectivity between the operations center and controllers using Java 11.

As with any upgrade, CloudBees recommends that you back up JENKINS_HOME and test the upgrade with a backup before you perform the upgrade on your production instance.

To upgrade CloudBees CI as well as the JVM, complete the following steps:

  1. Complete the steps in Upgrading CloudBees CI on traditional platforms or Upgrading CloudBees Jenkins Platform.

  2. Complete the steps in Upgrading plugins from the Plugin Manager.

  3. Back up JENKINS_HOME again after upgrading CloudBees CI and any required plugins.

  4. Stop the CloudBees CI instance.

  5. Upgrade the JVM in the environment where CloudBees CI is running. The upgrade process varies by system and your preferences (for example, tar ball, package manager, etc.). Make sure the JVM is the newly updated Java 11.

  6. Update any JVM arguments as documented in JVM recommended arguments.

If you use Docker containers to run CloudBees CI, the default Docker containers are configured with Java 11 beginning in version 2.332.1.4.

Upgrading plugins

In addition to upgrading CloudBees CI and the JVM, you must upgrade any plugins that support Java 11. Plugin upgrades ensure compatibility with the most recent CloudBees CI releases. CloudBees has verified that all plugins in the CloudBees Assurance Program run without issue when using Java 11.

If you discover a previously unreported issue, contact CloudBees Support.

Monitoring Java versions automatically

The Versions Node Monitors plugin provides detailed Java version monitoring and can detect unsupported JVM versions.

Known issues

Refer to the following sections for any known issues that may affect your migration to Java 11.

Mixed-mode (Java 11 and Java 8) support until version 2.361.1.2 excluded

Starting with version 2.332.1.4, CloudBees CI supports running in a mixed JVM environment. CloudBees strongly recommends that you begin planning your upgrade now, while a mixed JVM is still supported, in order to avoid being forced to upgrade when Java 11 is required.

Starting with version 2.361.1.2, Java 11 is required, and running in a mixed JVM environment is no longer supported for CloudBees CI.

Java XML bind libraries

Some plugins use JAXB libraries provided by the JDK. However, the java.xml.bind and javax.activation modules are no longer included in OpenJDK 11, and plugins might fail if no replacement is offered.

To resolve this issue, those libraries are now bundled in a new detached plugin called the JAXB plugin. When CloudBees CI detects that it is running in a Java 11+ environment, this plugin is automatically installed. However, if you manage your plugins outside of CloudBees CI (for example, if you use plugins.txt in your Docker images), you may need to install the plugin explicitly.

JVM version on agents

All agents must be running on the same JVM version as the controller because of how controllers and agents communicate. If you upgrade your CloudBees CI controller to run on Java 11, you must also upgrade the JVM on your agents.

You can validate each agent’s version using the Version Node Monitors plugin. This plugin provides information about the JVM version of each agent on the node management screen of your CloudBees CI instance. You can also configure this plugin to automatically disconnect any agent with an incorrect JVM version.

JVM version on operations center shared agents

JVM instances are used to establish the remoting connection between shared agents and controllers, as well as shared agents and the operations center. Additional JVMs could be installed on the agent computer and used as build tools by controller jobs. Those JVMs are irrelevant in this context, and there is no need to update them as part of the CloudBees CI Java 11 migration.

Depending on the launch method and agent configuration, you might have to take additional actions when you upgrade to Java 11.

"Launch agent by connecting it to the controller" launch method

This launch method is also known as an "inbound" agent. It is the agent initiating the connection to the controller. This configuration also requires the agent computer to initiate the connection to the operations center.

This launch method requires two JVM instances. One maintains the connection to the operations center and it is called the shared agent control JVM. The other connects to the controller when the agent is leased and it is called the agent JVM. These two JVM instances do not need to be running the same JVM version.

When you upgrade the operations center JVM to Java 11, the shared agent control JVM must also be upgraded to run Java 11. If the shared agent is going to be leased to a controller that runs Java 11, the agent JVM must also be upgraded to run Java 11.

"Launch build agents via SSH" launch method

This launch method is also known as an "outbound" agent. It means the controller is initiating the connection to the agent computer via SSH and then automatically starting the agent JVM.

There is no shared agent control JVM involved in this configuration. There is only one JVM, the agent JVM. The agent JVM must be updated if the agent is going to be leased to controllers that run Java 11. The path to this JVM binary is configurable in the shared agent configurations.

Java Web Start

Java Web Start was removed in Java 11. When a CloudBees CI controller runs on Java 11, the Java Web Start button no longer appears in the UI. You cannot launch agents for a Java 11 Jenkins server from a *.jnlp file that was downloaded to a web browser.

There are no plans to replace this functionality. Connect agents to CloudBees CI on Java 11 with plugins like the CloudBees SSH Build Agents Plugin, with operating system command line calls to java -jar agent.jar, or using containers.

Executing jobs on CloudBees CI

CloudBees CI jobs can be executed on Java versions that differ from the controller/agent runtime’s Java version. Generally, CloudBees CI allows any version of JRE/JDK to be invoked during the build. That includes executing Java commands from the CLI, as well as installing and executing build steps using a JDK managed by JDK tool installers.

There are still Java requirements for particular plugins:

Custom JVM arguments

Some JVM arguments have changed or are no longer supported by Java 11. If you customized the JVM arguments used to start your CloudBees CI operations center, controllers, or agents, you may need to modify them. For more information about the recommended JVM arguments, refer to Adding Java arguments to the Jenkins service configuration file.

Garbage collection logging parameters have changed in Java 11. If you have enabled garbage collection logging on your instance, you must update these parameters or your instance may fail to start. CloudBees recommends removing garbage collection logging, unless you use it specifically to troubleshoot an issue.

For a complete list of JVM arguments that have been removed in Java 11, refer to the following topics: