HBASE-25058 Export necessary modules when running under JDK11 (#4337)

Singed-off-by: Nick Dimiduk <ndimiduk@apache.org>
(cherry picked from commit 82e47cde27)
This commit is contained in:
Duo Zhang 2022-04-21 23:49:27 +08:00
parent 5c0c15b1c5
commit 96628db03d
2 changed files with 19 additions and 3 deletions

View File

@ -490,6 +490,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}"
@ -783,11 +787,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."
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

11
pom.xml
View File

@ -2851,7 +2851,16 @@
<properties>
<maven.compiler.release>${releaseTarget}</maven.compiler.release>
<!-- TODO: replicate logic for windows support -->
<argLine>--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED ${hbase-surefire.argLine}</argLine>
<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}</argLine>
<!-- We need a minimum HDFS version of 3.2.0 for HADOOP-12760 -->
<hadoop-three.version>3.2.0</hadoop-three.version>
<!--