本文介绍了蜂巢:异常..类jdk.internal.loader.ClassLoaders $ AppClassLoader无法转换为类java.net.URLClassLoader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行命令 hive 时,出现以下错误.

When I run the command hive, I get following error.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/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.<init>(SessionState.java:374)
    at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:350)
    at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:663)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
    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:244)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:158)

下面给出的是$ JAVA_HOME

Given below is the $JAVA_HOME

/usr/lib/jvm/java-11-openjdk-amd64/

推荐答案

您需要安装Java 8,然后编辑hadoop-env.sh以包括:

You need to install Java 8 and then edit your hadoop-env.sh to include:

export JAVA_HOME=/path/to/home/for/java8

别忘了使用 start-all.sh 启动hadoop服务.

Don't forget to start your hadoop services with start-all.sh.

这篇关于蜂巢:异常..类jdk.internal.loader.ClassLoaders $ AppClassLoader无法转换为类java.net.URLClassLoader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 08:28