Skip to content

Commit c5ae35b

Browse files
committed
HBASE-25058 Export necessary modules when running under JDK11
1 parent ea9bc92 commit c5ae35b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

bin/hbase

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,10 @@ add_jdk11_deps_to_classpath() {
492492
done
493493
}
494494

495+
add_jdk11_jvm_flags() {
496+
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"
497+
}
498+
495499
add_opentelemetry_agent() {
496500
if [ -e "${OPENTELEMETRY_JAVAAGENT_PATH}" ] ; then
497501
agent_jar="${OPENTELEMETRY_JAVAAGENT_PATH}"
@@ -811,11 +815,14 @@ fi
811815

812816
if [ "${addJDK11Jars}" = "true" ]; then
813817
add_jdk11_deps_to_classpath
818+
add_jdk11_jvm_flags
814819
if [ "${DEBUG}" = "true" ]; then
815-
echo "Added JDK11 jars to classpath."
816-
fi
820+
echo "Added JDK11 jars to classpath."
821+
echo "Added JDK11 JVM flags too."
822+
fi
817823
elif [ "${DEBUG}" = "true" ]; then
818824
echo "JDK11 jars skipped from classpath."
825+
echo "Skipped adding JDK11 JVM flags."
819826
fi
820827

821828
if [[ -n "${HBASE_TRACE_OPTS}" ]]; then

pom.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,16 @@
30303030
<properties>
30313031
<maven.compiler.release>${releaseTarget}</maven.compiler.release>
30323032
<!-- TODO: replicate logic for windows support -->
3033-
<argLine>--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED ${hbase-surefire.argLine}</argLine>
3033+
<argLine>-Dio.netty.tryReflectionSetAccessible=true
3034+
--illegal-access=permit
3035+
--add-modules jdk.unsupported
3036+
--add-opens java.base/java.nio=ALL-UNNAMED
3037+
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
3038+
--add-opens java.base/java.lang=ALL-UNNAMED
3039+
--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED
3040+
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
3041+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
3042+
${hbase-surefire.argLine}</argLine>
30343043
<!-- We need a minimum HDFS version of 3.2.0 for HADOOP-12760 -->
30353044
<hadoop-three.version>3.2.0</hadoop-three.version>
30363045
<!--

0 commit comments

Comments
 (0)