1

I installed Hive and Hadoop on my Ubuntu VM.

When I launch hive on the terminal I get this:

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/apache-hive-2.3.5-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/home/hadoop/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap') at org.apache.hadoop.hive.ql.session.SessionState.(SessionState.java:394) at org.apache.hadoop.hive.ql.session.SessionState.(SessionState.java:370) at org.apache.hadoop.hive.cli.CliSessionState.(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:566) at org.apache.hadoop.util.RunJar.run(RunJar.java:323) at org.apache.hadoop.util.RunJar.main(RunJar.java:236)

And when I launch hiverserver2, http://localhost:10002/, which is Hive WebUI, stays inaccessible.

I already tried this.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Haha
  • 973
  • 16
  • 43
  • What JDK version do you have? There is a known issue with JDK 11: https://issues.apache.org/jira/browse/HIVE-21237. There is also a this SO https://stackoverflow.com/questions/47897645/hive-appclassloader-cannot-be-cast-to-urlclassloader-although-using-jdk8 that seems to imply that hive shell script only works with JDK 8. – mazaneicha Jun 11 '19 at 13:31
  • I am on JDK11. I can't see a solution on the link you mentionned – Haha Jun 11 '19 at 13:33
  • 1
    You'll have to install JDK 8 and either uninstall 11 or modify hive startup script, as mentioned here https://www.mostlymaths.net/2019/02/apache-hive-and-javalangclasscastexcept.html – mazaneicha Jun 11 '19 at 13:36
  • I installed JDK8 and it worked perfectly. Thank you @mazaneicha – Haha Jun 11 '19 at 14:30

1 Answers1

1

As @mazaneicha suggested, It is easier to do it with JDK8. I was on JDK11. So I just

Haha
  • 973
  • 16
  • 43