From 11c418b83f13d0c37d18adfee5b4e80931681817 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Mon, 11 Apr 2022 23:11:15 +0800 Subject: [PATCH] HBASE-25058 Export necessary modules when running under JDK11 --- bin/hbase | 11 +++++++++-- pom.xml | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/hbase b/bin/hbase index 1f8b9dadb066..3623ad89434b 100755 --- a/bin/hbase +++ b/bin/hbase @@ -492,6 +492,10 @@ add_jdk11_deps_to_classpath() { done } +add_jdk11_jvm_flags() { + HBASE_OPTS="$HBASE_OPTS --illegal-access=permit --add-modules jdk.unsupported -Dio.netty.tryReflectionSetAccessible=true --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/jdk.internal.ref=ALL-UNNAME --add-exports java.base/jdk.internal.misc=ALL-UNNAMED" +} + add_opentelemetry_agent() { if [ -e "${OPENTELEMETRY_JAVAAGENT_PATH}" ] ; then agent_jar="${OPENTELEMETRY_JAVAAGENT_PATH}" @@ -811,11 +815,14 @@ fi if [ "${addJDK11Jars}" = "true" ]; then add_jdk11_deps_to_classpath + add_jdk11_jvm_flags if [ "${DEBUG}" = "true" ]; then - echo "Added JDK11 jars to classpath." - fi + echo "Added JDK11 jars to classpath." + echo "Added JDK11 JVM flags too." + fi elif [ "${DEBUG}" = "true" ]; then echo "JDK11 jars skipped from classpath." + echo "Skipped adding JDK11 JVM flags." fi if [[ -n "${HBASE_TRACE_OPTS}" ]]; then diff --git a/pom.xml b/pom.xml index 20b1bc5a0f41..17304acac2ba 100644 --- a/pom.xml +++ b/pom.xml @@ -3030,7 +3030,7 @@ ${releaseTarget} - --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED ${hbase-surefire.argLine} + --illegal-access=permit --add-modules jdk.unsupported -Dio.netty.tryReflectionSetAccessible=true --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/jdk.internal.ref=ALL-UNNAME --add-exports java.base/jdk.internal.misc=ALL-UNNAMED ${hbase-surefire.argLine} 3.2.0