Support Questions

Find answers, ask questions, and share your expertise

Pig command not working in centos.

avatar
Contributor

We recently installed Pig 0.15.0 on our system. We already have Hadoop 2.7.1 installed on our system. But while running the pig command we get the following exception :-

[hadoop1@hp_proliant ~]$ pig
Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/runtime/RecognitionException
        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 org.apache.hadoop.util.RunJar.run(RunJar.java:215)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.RecognitionException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 7 more

Following is the content of our bashrc file for any reference to path settings :-

export JAVA_HOME=/opt/jdk1.8.0_65
export HADOOP_HOME=/home/hadoop1/hadoop1
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
export HBASE_HOME=/home/hadoop1/hbase-1.1.4
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$HADOOP_HOME/sbin:$HADOOP_HOME/bin:$HBASE_HOME/bin:$HBASE_HOME/lib/*
export CLASSPATH=$CLASSPATH:/home/hadoop1/hbase-1.1.4/lib/*
export PIG_HOME=/home/hadoop1/Pig
export PATH=$PATH:/home/hadoop1/Pig/bin
export PIG_CLASSPATH=$CLASSPATH:/home/hadoop1/Pig/lib/*

What possible could be the problem for this exception?

1 ACCEPTED SOLUTION

avatar
Contributor

The command worked! I added the lib dir of Pig to the HADOOP_CLASSPATH in hadoop-env.sh.

View solution in original post

5 REPLIES 5

avatar
Super Guru

@Kumar Sanyam

Looks like below jar is missing from PIG lib directory. Please cross check

antlr-runtime-<version>.jar

avatar
Contributor

It exists in the lib directory. : /home/hadoop1/Pig/lib/antlr-runtime-3.4.jar

avatar
Super Guru

@Kumar Sanyam

Could you please check whether antlr runtime is available in pig classpath using

pig -printCmdDebug | grep antlr --color

avatar
Contributor

/home/hadoop1/Pig/lib/antlr-runtime-3.4.jar

The above line exists in the output generated while running the given command.

avatar
Contributor

The command worked! I added the lib dir of Pig to the HADOOP_CLASSPATH in hadoop-env.sh.