Project

General

Profile

Switching Between Java 8 and Java 11

Introduction

In FWD v3.x, only Java 8 is supported.

Starting in FWD v4, both Java 8 and Java 11 are supported. Java 11 support was implemented in #5567.

The two main goals:

  • bring Java 11 support to FWD
  • minimize impact on support for Java 8 (do not break it)

Java 8 stays as main FWD runtime platform, but any project can be upgraded to Java 11 if up to 30% performance degradation is accepted.

Older project configurations were designed to run on Java 8, so nothing needs to be done to keep those configurations on Java 8. If a project wants to support Java 11, then changes to scripts/runtime are needed. The changes may be implemented such that, one can switch only the current Java runtime from Java 8 to Java 11 and back are needed for migration.

The goal of minimizing impact of Java 8 was achieved by minimizing changes to FWD project and its dependencies, as some upgrades of dependencies were necessary due to Java 11 compatibility.
Additionally some tweaks to the FWD code have been implemented to make its code compatible with newer Java VM APIs and to remove build warnings (most of).

Note that the JAVA UDF (PL/Java) feature was not tested and is not supported with Java 11.

Performance Problems in Java 11

All other things being equal (same hardware, OS, converted code and configuration), Java 11 is up to 30% slower than Java 8. This has been measured in simulations as well as with real converted application code. For this reason, it is recommended to avoid Java 11 in production installations.

Supported Configurations

The following configurations are tested and supported:

  • Build Java 8, Conversion Java 8, Runtime Java 8 - build processes tools and code, conversion and compiled generated/custom code are executed with Java 8 runtime,
  • Build Java 11, Conversion Java 11, Runtime Java 11 - build processes tools and code, conversion and compiled generated/custom code are executed with Java 11 runtime,

Java 9 and Java 10 have not been tested and are not supported in any way.

Unsupported Configurations

Following configurations are not tested and are not supported.

  • Build Java 8, Conversion Java 8, Runtime Java 11
  • Build Java 8, Conversion Java 11, Runtime Java 11

Updated Dependencies

The following changes were brought into the 3821c branch by #5567:

  • AspectJ was upgraded to 1.9.7
  • reflectasm was upgraded to version 1.11.6
  • gwt-user, gwt-dev and gwt-codeserver were upgraded to version: 2.9.0

Java 11 Migration Process

Once the java runtime is switched and application fully rebuilt everything should work as before. By "rebuilt" we mean that FWD needs to be recompiled and any converted code needs to be recompiled.

Before this shift is done, some changes may be needed to a given project configuration.

FWD Build Scripts

FWD build scripts (build.xml and build.gradle) detect the Java version runtime and configure environment according to the detected java version, so no changes are needed.

Conversion

Conversion is independent of the Java runtime version. No changes to the conversion process are required. Source files converted/generated with FWD running Java 8 are identical to files generated by FWD running Java 11.

Project Build Scripts

Project-specific (custom) scripts (mainly build_db.xml) must be updated accordingly to reflect a new way Java 11 supports SPI feature:

  • p2jspi.jar needs to be added to classpath
  • -Djava.ext.dirs= directive must be removed from server java command line
  • -Djava.locale.providers should be now SPI,CLDR,COMPAT instead of SPI,CLDR

Scripts supporting both Java 8 and Java 11 need to detect Java version and act accordingly.

For projects created from the standard project templates like hotel_gui, please check the way Java 11 is detected and supported in build_db.xml in commit 253 to hotel_gui (bzr diff -c 253).

FWD Server Runtime

FWD server scripts need to be updated to reflect a new way Java 11 supports SPI feature:

  • p2jspi.jar needs to be added to classpath
  • -Djava.ext.dirs= directive must be removed from server java command line
  • -Djava.locale.providers should be now SPI,CLDR,COMPAT instead of SPI,CLDR

Scripts supporting both Java 8 and Java 11 need to detect Java version and act accordingly.

For projects created from the standard project templates like hotel_gui, please check the way Java 11 is detected and supported in build_db.xml in commit 253 to hotel_gui (bzr diff -c 253).

FWD Client Runtime

For standard installation no update is required for FWD client scripts to run with Java 11.

FWD Spawner Runtime

spawner needs to be rebuilt with Java 11 and reinstalled/redeployed, as spawner binary has hardcoded reference to Java libraries runtime present at compile time.

For the standard installation spawner build script is a part of FWD build script, thus only rebuild and reinstall is necessary.
For other types of installations build scripts need to be updated accordingly.

Simplified Migration Plan

Simplified plan to migrate a project from Java 8 to Java 11:

  1. Development: migrate any custom (software out of FWD project) platform extensions to Java 11.
  2. Install java 11 on build server
  3. Switch build server environment to java 11
  4. Build FWD for java 11
  5. Build the project for java 11 with FWD for java 11
  6. Test the project for java 11 with FWD for java 11
  7. Install java 11 on runtime servers
  8. Install the project for java 11 on runtime servers, I'd suggest to install spawner in different directory if quick rollback is needed
  9. Stop app for java 8, run app for java 11 on runtime servers (with updated spawner directory configuration if needed)

Java 11 Migration Process Q&A and Tips

  • Make sure spawner is also migrated.
  • On Ubuntu Linux 20.04 its possible to switch Java version system wide with sudo update-java-alternatives --set <java_version_string>
  • On Ubuntu Linux 20.04 its possible to check Java version by executing 'cat /proc/<pid>/exe' - to make sure correct version of JVM is in use
  • .g files were changed to fix Java 11 compile warnings, there are no functional changes. -> If you stay on Java 8 full conversion is not needed, if you switch to Java 11 full conversion is recommended.

© 2022 Golden Code Development Corporation. ALL RIGHTS RESERVED.