跟随the getting started procedure
时,我无法启动Hive这是错误:
$ ./hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoopuser/Downloads/apache-hive-3.1.2-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoopuser/hadoop-2.8.5/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]
Hive Session ID = 3494229b-6c3c-4c5b-ba62-a82edde75f18
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:566)
at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
我认为这个问题来自Java版本,基于其他SO问题。但是他们没有帮助我。
运行java -version
时,我得到:
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)
但是,当我得到$ JAVA_HOME变量时,它已正确设置为java 1.8:
$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-amd64
但是,当我使用替代命令选择我的Java版本时,会得到以下结果:
$ sudo update-alternatives --config java
[sudo] password for hadoopuser:
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2
我在做什么错了?
编辑1:运行./beeline -u jdbc:hive2://
答案 0 :(得分:2)
可能是Java 11的二进制文件仍然在您的PATH中排在第一位。检查Java 11的bin文件夹是否首先显示为ia
。
如果是这样,一个快速的解决方法可能只是将Java 8 bin文件夹的路径添加到您的int[] ia_copy;
public MarkovTest(int[] ia, Amalthea model, int ID, int startRange, int stopRange) {
this.model = model;
//----> create a copy like this:
ia_copy=new int[ia.length];
System.arraycopy( ia, 0, ia_copy, 0, ia.length );
this.nbCPUs = CommonUtils.getNumberofCPUs(model);
// this.nbGPUs = CommonUtils.getNumberofGPUs(this.model);
this.nbPUs = CommonUtils.getNumberofPUs(model);
this.ID = ID;
this.startRange = startRange;
this.stopRange = stopRange;
init();
}
文件中。附加这样的内容可能会有所帮助:
@Override
public String call() {
...
while (System.currentTimeMillis() < endTime) {
//----> ia to ia_copy
int[] currentMapping = generateTpuMappingWithRange(ia_copy , startRange, stopRange);
...
然后echo $PATH
应该显示正确的一个。