hadoop_1@shubho-HP-Notebook:~$ hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop_1/apache-hive-2.3.2-bin/lib /log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop_1/hadoop/share/hadoop/common /lib/slf4j-log4j12-1.7.10.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: 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:564)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
hadoop_1@shubho-HP-Notebook:~$
抛出上述异常。所以我查了一下,没有conf / hive-site.xml。所以我创建并编辑了它:
<property>
<name>hive.exec.local.scratchdir</name>
<value>$HIVE_HOME/iotmp</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.querylog.location</name>
<value>$HIVE_HOME/iotmp</value>
<description>Location of Hive run time structured log file</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>$HIVE_HOME/iotmp</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
仍然会抛出相同的错误。
答案 0 :(得分:3)
我正在努力解决同样的错误。我发现问题是因为我安装了java 9并使用java 9配置了hadoop。而Hive不支持java版本9。
解决方案是用java版本8替换java版本9.安装java版本8,然后在java 8上配置hadoop和hive。
打开文件$HADOOP_HOME/etc/hadoop/hadoop-env.sh
并粘贴以下行:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
在配置配置单元时也设置相同的地址。
答案 1 :(得分:0)
我面临同样的问题,hive出售时没有启动类型命令hive.first,我是检查所有守护进程是否正在运行或不使用jps命令,在我的情况下namenode不工作。所以首先停止所有运行守护进程使用停止-all.sh然后格式化namenode(namenode -format)并再次从start-all.sh开始,然后使用jps检查它。如果问题仍然存在,你可以检查你的配置文件并再次配置,这对我有用。 / p>