1

I have installed jdk8 and while running hive, I got the following information

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = f9b039ac-ca16-4fe1-ba61-aecb31e0462e
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.<init>(SessionState.java:413)
    at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:389)
    at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683)
    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:567)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:236)

I have tried the solutions in similar_question and similar_question , but I still got the same problem. I have already set my jdk version to be jdk8:

java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

I installed hadoop and hive using brew, and the corresponding versions are:

Hadoop 3.2.1

and

Hive 3.1.2
Git git://HW13934/Users/gates/tmp/hive-branch-3.1/hive -r 8190d2be7b7165effa62bd21b7d60ef81fb0e4af
Compiled by gates on Thu Aug 22 15:01:18 PDT 2019
From source with checksum 0492c08f784b188c349f6afb1d8d9847

How can I solve this problem?

Cmeng
  • 11
  • 2

1 Answers1

0

I really have the same feeling as you. But if you don't give up, you will get it in the end. Good luck!

  1. You can definitely find something helpful in this article

Hive : Exception.. class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader

it told us to set the correct configuration.

  1. You have to make sure that you start your hadoop cluster before running hive and also guarantee that all the services are running normally.
cd /usr/local/Cellar/hadoop/3.2.1/sbin/
./start-all.sh

above is the terminal shell code for you to start the hadoop

  1. [important]

To make sure all the nodes are started well.

also you have to configure hadoop in Pseudo-distributed mode rather than

standalone mode.

If you can read chinese, below is also an useful article which helps me a lot.

https://www.jianshu.com/p/af8a50f5a653

Hanson_K
  • 1
  • 1