Considerations for Hive on JDK 17 and later
Considerations for Hive on JDK 17 and later
IMPORTANT
If you have installed JDK 17 or later with DEP 10.0.0 or later, no action is necessary. As of
DEP 10.0.0, Hive auto-configuration
completes the following:- The MapR configuration tool adds the required properties to
hive-site.xmlautomatically. configure.shadds the Hadoop options tohive-env.shautomatically.
If you are running a version of DEP earlier than version 10.0.0, you must configure these settings manually.
Proceed to the next section if you have installed JDK versions earlier than JDK 17.
Considerations for Hive on versions earlier than JDK 17
When configured correctly, Hive works on
versions
earlier than DK 17, but it is still possible to encounter an error such
as:
Caused by: java.lang.reflect.InaccessibleObjectException: <detailed description>: module java.base does not "opens <module name>" to unnamed module Here
is an example of the
error:Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final int java.time.LocalDate.year accessible: module java.base does not "opens java.time" to unnamed module To fix the issue, you must add the following
fix:
--add-opens java.base/<module name>=ALL-UNNAMEDFor
example:--add-opens java.base/java.time=ALL-UNNAMED You must add the fix in two places:
HADOOP_OPTSvariable in thehive-env.shconf filemapreduce.map.java.opts, mapreduce.reduce.java.opts, yarn.app.mapreduce.am.command-optsproperties of thehive-site.xml conffile
Here is an example of making the fix:
- Add the following entry to the
hive-env.shfile:export HADOOP_OPTS="-XX:+IgnoreUnrecognizedVMOptions --add-opens java.base/java.time=ALL-UNNAMED" - Add the following properties to the
hive-site.xmlfile:<property> <name>mapreduce.map.java.opts</name> <value>-Xmx900m --add-opens java.base/java.lang=ALL-UNNAMED -XX:+UseParallelGC --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED</value> </property> <property> <name>mapreduce.reduce.java.opts</name> <value>-Xmx2560m --add-opens java.base/java.lang=ALL-UNNAMED -XX:+UseParallelGC --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED</value> </property> <property> <name>yarn.app.mapreduce.am.command-opts</name> <value>-Xmx2560m --add-opens java.base/java.lang=ALL-UNNAMED -XX:+UseParallelGC --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED</value> </property>