hive:异常:类jdk.internal.loader.classloaders$appclassloader不能在mac上使用jdk8强制转换为类java.net.urlclassloader

rbpvctlc  于 2021-05-31  发布在  Hadoop
关注(0)|答案(0)|浏览(545)

我已经安装了jdk8,在运行hive时,我得到了以下信息

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)

我试过类似问题和类似问题的解决方法,但还是遇到了同样的问题。我已经将我的jdk版本设置为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)

我使用brew安装了hadoop和hive,相应的版本是:

Hadoop 3.2.1

以及

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

我怎样才能解决这个问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题