This question already has an answer here:
- Explanation of “ClassCastException” in Java 11 answers
Whenever I try to load hive shell, it shows this error:
Exception in thread "main" java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:394)
at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:370)
at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:708)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:543)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
I have java 9 and hadoop 2.7.3.
How can I overcome this error?
Any help will be appreciated.
You can have multiple versions of Java installed on a given system.
With your listeners versions, you'll need to downgrade.
You can edit the
hadoop-env.sh
file in your Hadoop home directory to relocateJAVA_HOME
No. Java 9 support is still in development. Refer to the following JIRAs if you want to track progress:
https://issues.apache.org/jira/browse/HADOOP-11123 - Uber-JIRA: Hadoop on Java 9 https://issues.apache.org/jira/browse/HIVE-17632 - Build Hive with JDK9