Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> Embeding pig with local mode and ERROR 1002


Copy link to this message
-
Re: Embeding pig with local mode and ERROR 1002
Hi, Bojan:
Does the file 'input' exist in your local FS? (in first Pig command A load '" + inputFile + "' using PigStorage(':');)
Can you share your complete test code? Thanks.

Johnny
On Thu, Feb 21, 2013 at 3:30 PM, Bojan Kostić <[EMAIL PROTECTED]> wrote:

>
> Hallo, so i have trouble with Pig and Java.
> Well, in mapreduce mode pig works, but it is slow for testing and
> learning...
> Im trying to set Java class to test pig scripts and learn how to use those
> two together.
>
> My class is example from website:
>
> import java.io.IOException;
> import org.apache.pig.ExecType;
> import org.apache.pig.PigServer;
> public class idlocal{
> public static void main(String[] args) {
> try {
>     PigServer pigServer = new PigServer(ExecType.LOCAL);
>     runIdQuery(pigServer, "passwd");
>     }
>     catch(Exception e) {
>         System.out.println(e.toString());
>         e.printStackTrace();
>     }
>  }
> 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", "id.out");
>  }
> }
>
> And this is stack trace:
> log4j:WARN No appenders could be found for logger
> (org.apache.pig.impl.util.PropertiesUtil).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> org.apache.pig.PigException: ERROR 1002: Unable to store alias B
> org.apache.pig.PigException: ERROR 1002: Unable to store alias B
>         at org.apache.pig.PigServer.storeEx(PigServer.java:965)
>         at org.apache.pig.PigServer.store(PigServer.java:928)
>         at org.apache.pig.PigServer.store(PigServer.java:896)
>         at com.bs.svinjac.idlocal.runIdQuery(idlocal.java:20)
>         at com.bs.svinjac.idlocal.main(idlocal.java:10)
> Caused by: org.apache.pig.backend.executionengine.ExecException: ERROR
> 2043:
> Unexpected error during execution.
>         at org.apache.pig.PigServer.launchPlan(PigServer.java:1290)
>         at
> org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1264)
>         at org.apache.pig.PigServer.storeEx(PigServer.java:961)
>         ... 4 more
> Caused by: java.io.IOException: Cannot initialize Cluster. Please check
> your
> configuration for mapreduce.framework.name and the correspond server
> addresses.
>         at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:119)
>         at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:81)
>         at org.apache.hadoop.mapreduce.Cluster.<init>(Cluster.java:74)
>         at org.apache.hadoop.mapred.JobClient.init(JobClient.java:491)
>         at org.apache.hadoop.mapred.JobClient.<init>(JobClient.java:470)
>         at
>
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(MapReduceLauncher.java:156)
>         at org.apache.pig.PigServer.launchPlan(PigServer.java:1279)
>         ... 6 more
> BUILD SUCCESSFUL (total time: 1 second)
>
> And if someone is interested these are the dependencies for my
> project(maven):
> <dependency>
>     <groupId>org.apache.pig</groupId>
>     <artifactId>pig</artifactId>
>     <version>0.10.1</version>
> </dependency>
> <dependency>
>     <groupId>org.apache.hadoop</groupId>
>     <artifactId>hadoop-common</artifactId>
>     <version>2.0.3-alpha</version>
> </dependency>
> <dependency>
>     <groupId>org.apache.hadoop</groupId>
>     <artifactId>hadoop-mapreduce-client-core</artifactId>
>     <version>2.0.3-alpha</version>
> </dependency>
> <dependency>
>     <groupId>org.antlr</groupId>
>     <artifactId>antlr-runtime</artifactId>
>     <version>3.5</version>
> </dependency>
>
> Best regards.
>
>