From af1bf8ae35eb5a925f85920704886cd6217bdac2 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Thu, 21 Apr 2022 22:40:59 +0800 Subject: [PATCH] HBASE-25058 Export necessary modules when running under JDK11 --- bin/hbase | 11 +++++++++-- pom.xml | 11 ++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/hbase b/bin/hbase index 1f8b9dadb066..fd92b126ea4b 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 -Dio.netty.tryReflectionSetAccessible=true --illegal-access=permit --add-modules jdk.unsupported --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --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 b525d9777371..206f2502e2e3 100644 --- a/pom.xml +++ b/pom.xml @@ -3036,7 +3036,16 @@ ${releaseTarget} - --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED ${hbase-surefire.argLine} + -Dio.netty.tryReflectionSetAccessible=true + --illegal-access=permit + --add-modules jdk.unsupported + --add-opens java.base/java.nio=ALL-UNNAMED + --add-opens java.base/sun.nio.ch=ALL-UNNAMED + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/jdk.internal.ref=ALL-UNNAMED + --add-opens java.base/java.lang.reflect=ALL-UNNAMED + --add-exports java.base/jdk.internal.misc=ALL-UNNAMED + ${hbase-surefire.argLine} 3.2.0