Required JVM Access Flags When Installing GemFire Management Console on Java 17 and Above
search cancel

Required JVM Access Flags When Installing GemFire Management Console on Java 17 and Above

book

Article ID: 407821

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

When running the GemFire Management Console JAR on Java 17 or newer, you may encounter initialisation errors similar to the following:

Caused by: java.lang.ExceptionInInitializerError: null
    at org.apache.catalina.startup.Tomcat.<clinit>(Tomcat.java:1216) ~[tomcat-embed-core-9.0.99.jar!/:na]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:194) ~[spring-boot-2.7.18.jar!/:2.7.18]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.18.jar!/:2.7.18]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.18.jar!/:2.7.18]
    ... 16 common frames omitted
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field static final boolean java.io.FileSystem.useCanonCaches accessible: module java.base does not "opens java.io" to unnamed module @1bc6a36e
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na]
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) ~[na:na]
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) ~[na:na]
    at org.apache.tomcat.util.compat.JreCompat.<clinit>(JreCompat.java:131) ~[tomcat-util-9.0.99.jar!/:9.0.99]
    ... 20 common frames omitted"

 

This error occurs during application startup and is commonly seen with Java 17+ due to increased module security.

Environment

NA

Cause

Starting with Java 17, the Java Platform Module System enforces stricter encapsulation of internal APIs. The GemFire Management Console and its dependencies (such as Tomcat) require reflective access to certain classes and fields within core Java modules, which is restricted by default. Without the appropriate JVM access flags, reflective operations needed for application initialization will fail, resulting in the error above.

To allow proper startup and functionality, the following access flags must be provided:

  • --add-opens java.base/java.lang=ALL-UNNAMED

  • --add-opens java.base/java.util=ALL-UNNAMED

  • --add-opens java.base/java.io=ALL-UNNAMED

Resolution

When launching the GemFire Management Console, include the required --add-opens flags in your Java command to permit necessary reflection.

In the example below we use version 1.3.1 of the Management Console:

java --add-opens java.base/java.lang=ALL-UNNAMED \
     --add-opens java.base/java.util=ALL-UNNAMED \
     --add-opens java.base/java.io=ALL-UNNAMED \
     -jar gemfire-management-console-1.3.1.jar --server.port=7077


     
Including these flags ensures compatibility and successful startup of the GemFire Management Console on Java 17 and above.