文章目录
1、错误一: ‘beeline’ 不是内部或外部命令,也不是可运行的程序或批处理文件
错误原因:缺少beeline.cmd
文件
解决方法:从之前版本中找到beeline.cmd
并拷贝到Hive安装目录的bin目录下
从hive-2.1.0之后就不再提供beeline.cmd
文件,[下载Hive-2.1.0]并复制相关文件到对应文件夹。当然,win10下对于找不到hive
命令也同样有效,解决方法也类似
2、错误二: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveConf
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/conf/HiveConf
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 7 more
错误原因: Hadoop找不到hive中的HiveConf
类
解决方法: Hive安装目录下,将hive-common-3.1.2.jar
复制到Hadoop安装目录下的\share\hadoop\common\lib
中
首先为我们看看Hive中那个jar包包含这个类,查看命令:
jar -tf 包名.jar | grep -i "类名"
我们进入Hive安装目录下的lib
文件夹:
jar -tf hive-common-3.1.2.jar | grep -i 'HiveConf'
发现该jar包中包含HiveConf
类
所以,这里我们可以将相关jar包,放到对应的文件目录中
3、错误三: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hive/jdbc/JdbcUriParseException
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hive/jdbc/JdbcUriParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: org.apache.hive.jdbc.JdbcUriParseException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 7 more
错误原因: Hadoop找不到jdbc中的JdbcUriParseException
类
解决方法: Hadoop缺少hive-jdbc-***.jar,将Hive安装目录下的lib文件夹中的hive-jdbc-3.1.2.jar
包复制到Hadoop安装目录下的\share\hadoop\common\lib
中