The shell is interpreting the semicolons as meaning a new command is being
entered. You might need to use some quotation marks around the classpath
On Dec 3, 2015 11:34 PM, "Shashi Vishwakarma" <shashi.vish...@gmail.com>
wrote:

> Hi
> I am trying to simple pig code but its giving me some permission. Here is
> my sample pig code.
>
> import java.io.IOException;import org.apache.pig.PigServer;import
> org.apache.pig.ExecType;import
> org.apache.hadoop.conf.Configuration;public class PigTest{
>    public static void main(String[] args) {
>    try {
>         Configuration conf = new Configuration();
>         conf.set("hdp.version","2.3.0.0-2557");
>         //PigServer pigServer = new PigServer("mapreduce",conf);
>         PigServer pigServer = new PigServer(ExecType.MAPREDUCE, conf);
>      runIdQuery(pigServer, "myfile.txt");
>    }
>    catch(Exception e) {
>    }}public static void runIdQuery(PigServer pigServer, String
> inputFile) throws IOException {
>    pigServer.registerQuery("A = load '" + inputFile + "' using
> PigStorage(':');");
>    pigServer.registerQuery("B = foreach A generate $0 as id;");
>    pigServer.store("B", "idout");
>    }}
>
> I set my classpath as below
>
> echo
> $CLASSPATH.:/usr/hdp/2.3.0.0-2557/hadoop/client/*:/usr/hdp/2.3.0.0-2557/hadoop-hdfs/lib/*:/usr/hdp/2.3.0.0-2557/hadoop-mapreduce/lib/*:/usr/hdp/2.3.0.0-2557/hadoop-yarn/lib/*:/usr/hdp/2.3.0.0-2557/pig/lib/*:/usr/hdp/2.3.0.0-2557/hadoop/conf:/usr/hdp/2.3.0.0-2557/pig/pig-0.15.0.2.3.0.0-2557-core-h2.jar
>
> When i am running my code with java command it is working perfectly but
> when created a jar of my code and trying to run , it is giving me below
> permission error.
>
> *java -cp
> /usr/hdp/2.3.0.0-2557/hadoop/client**/*;*/usr/hdp/2.3.0.0-2557/hado*op-hdfs/lib/*;/usr/hdp/2.3.0.0-2557/hadoop-mapreduce/lib/*;/usr/hdp/2.3.0.0-2557/hadoop-yarn/lib/*;/usr/hdp/2.3.0.0-2557/pig/lib/*;/usr/hdp/2.3.0.0-2557/hadoop/conf;/usr/hdp/2.3.0.0-2557/pig/pig-0.15.0.2.3.0.0-2557-core-h2.jar
> -jar PigTest.jar*
>
> *Error: Could not find or load main class
> .usr.hdp.2.3.0.0-2557.hadoop.client.activation.jar
> -bash: /usr/hdp/2.3.0.0-2557/hadoop-hdfs/lib/asm-3.2.jar: Permission denied
> -bash: /usr/hdp/2.3.0.0-2557/hadoop-mapreduce/lib/aopalliance-1.0.jar:
> Permission denied
> -bash: /usr/hdp/2.3.0.0-2557/hadoop-yarn/lib/activation-1.1.jar:
> Permission denied
> -bash: /usr/hdp/2.3.0.0-2557/pig/lib/accumulo-core-1.5.0.jar: Permission
> denied
> -bash: /usr/hdp/2.3.0.0-2557/hadoop/conf: is a directory
> -bash: /usr/hdp/2.3.0.0-2557/pig/pig-0.15.0.2.3.0.0-2557-core-h2.jar:
> Permission denied*
>
>
> Any clue on this?
>
> Thanks
> Shashi
>

Reply via email to