hive 安装报错“java.lang.NoClassDefFoundError: org/apache/thrift/TException”

在集群安装hadoop  的情况下,hive 安装在master节点上,安装hive 报错:

如下:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift/TException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
Caused by: java.lang.ClassNotFoundException: org.apache.thrift.TException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 3 more



解决:1、先检查/etc/profile是否有正确配置CLASSPATH

export PIG_CLASSPATH=/home/hai/hadoop-1.2.1/conf/
export HADOOP_HOME=/home/hai/hadoop-1.2.1
export HIVE_HOME=/home/hai/hive-0.12.0
export JRE_HOME=$JAVA_HOME/jre  
export JAVA_HOME=/usr/jdk1.7.0_60
export JRE_HOME=$JAVA_HOME/jre  
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$HIVE_HOME/lib:$CLASSPATH  
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME/bin:$JRE_HOME/bin:/home/hai/hadoop-1.2.1/bin:/home/hai/pig-0.13.0/bin:/home/hai/hive-0.12.0/bin:$PATH
export TERM=xterm-color
2、检查hive-env.sh

# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=/home/hai/hadoop-1.2.1

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/home/hai/hive-0.12.0/conf


3、最有可以出现的地方(hadoop-env.sh)

#export HADOOP_CLASSPATH=/home/hai/hadoop-1.2.1/myclass
export HADOOP_CLASSPATH=.:$CLASSPATH:$HADOOP_CLASSPATH:$HADOOP_HOME/bin:/home/hai/

上面是原来的,下面是修改好的!祝你好运!



你可能感兴趣的:(hive 安装报错“java.lang.NoClassDefFoundError: org/apache/thrift/TException”)