Legacy Knowledge Base
Publicado Jul. 25, 2002

"Inaccessible Object" exception while using JDK11

Written By

Joel Garman

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Description

If you are using JDK11 in a Linux environment and have the LCS 5.0.0 client deployed, you may receive the following error on startup:

ERROR [LCS Worker 2][BaseScheduledTask:92] java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount() accessible: module jdk.management does not
 "opens com.sun.management.internal" to unnamed module @1a3325e5
java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @1a3325e5
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)

Resolution

This error occurs because JDK11 was recently added to the compatibility matrix. The following are workarounds for the Tomcat and Wildfly app servers

If you are migrating to JDK11 please also the reference the Illegal Access Warning known issue article.

Tomcat

Add these properties to Tomcat (e.g. tomcat/bin/setenv.sh) to avoid illegal access warning messages:

CATALINA_OPTS=
CATALINA_OPTS="$CATALINA_OPTS --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED"

Wildfly

Add these properties to Wildfly (e.g. wildfly/bin/standalone.conf) to avoid illegal access warning messages:

JAVA_OPTS="$JAVA_OPTS --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED"
Did this article resolve your issue ?

Legacy Knowledge Base