当我运行“pig-usehcatalog”时出现以下错误。
Exception inthread"main"java.lang.NoClassDefFoundError:/usr/lib/hive/lib/libthrift-
0/9/1/jar:/usr/lib/hive/lib/hive-exec-0/12/0/2/0/6/0-76/jar:/usr/lib/hive/lib/libfb303-
0/9/0/jar:/usr/lib/hive/lib/jdo-api-3/0/1/jar:/usr/lib/hive/lib/slf4j-api-1/7/2/jar
Caused by: java.lang.ClassNotFoundException: .usr.lib.hive.lib.libthrift-
0.9.1.jar:.usr.lib.hive.lib.hive-exec-0.12.0.2.0.6.0-76.jar:.usr.lib.hive.lib.libfb303-
0.9.0.jar:.usr.lib.hive.lib.jdo-api-3.0.1.jar:.usr.lib.hive.lib.slf4j-api-1.7.2.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: /usr/lib/hive/lib/libthrift-
0.9.1.jar:/usr/lib/hive/lib/hive-exec-0.12.0.2.0.6.0-76.jar:/usr/lib/hive/lib/libfb303-
0.9.0.jar:/usr/lib/hive/lib/jdo-api-3.0.1.jar:/usr/lib/hive/lib/slf4j-api-1.7.2.jar.
Program will exit
我已经定义了所有的环境变量(包括pig\u classpath)如下,并且在pig.properties文件中定义了pig.additiona.jars
export HADOOP_GROUP=hadoop ;
export HADOOP_HOME=/usr/lib/hadoop
export HCAT_HOME=/usr/lib/hcatalog
export HIVE_HOME=/usr/lib/hive
export templeton_host=$TEMPLETON_HOST
export user_name=hcat
export PIG_CLASSPATH=$HCAT_HOME/share/hcatalog/hcatalog-*.jar:\
$HIVE_HOME/lib/hive-metastore-*.jar:$HIVE_HOME/lib/libthrift-*.jar:\
$HIVE_HOME/lib/hive-exec-*.jar:$HIVE_HOME/lib/libfb303-*.jar:\
$HIVE_HOME/lib/jdo2-api-*-ec.jar:$HIVE_HOME/conf:$HADOOP_CONF_DIR:\
$HIVE_HOME/lib/slf4j-api-*.jar:/usr/lib/hive/lib/libthrift-
0.9.1.jar:/usr/lib/hive/lib/hive-exec-0.12.0.2.0.6.0-76.jar:/usr/lib/hive/lib/libfb303-
0.9.0.jar:/usr/lib/hive/lib/jdo-api-3.0.1.jar:/usr/lib/hive/lib/slf4j-api-1.7.2.jar
export PIG_OPTS=-Dhive.metastore.uris=thrift://$HIVE_HOST:$HIVE_PORT
在pig.properties文件中,
pig.additional.jars=/usr/lib/hive/lib/libthrift-0.9.1.jar:/usr/lib/hive/lib/hive-exec-
0.12.0.2.0.6.0-76.jar:/usr/lib/hive/lib/libfb303-0.9.0.jar:/usr/lib/hive/lib/jdo-api-
3.0.1.jar:/usr/lib/hive/lib/slf4j-api-1.7.2.jar
请告诉我如何解决这个问题。谢谢!
2条答案
按热度按时间2q5ifsrm1#
您需要在~./bashrc中配置环境变量
导出sqoop\u home=/usr/lib/sqoop
导出hbase\u home=/usr/local/hbase
导出配置单元\u home=/usr/local/hive
导出hcat\u home=/usr/local/hive/hcatalog
oewdyzsn2#
按照这里提到的步骤安装/配置hcatalog并将其与pig集成。