You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Benjamin Francisoud (JIRA)" <ji...@apache.org> on 2008/01/23 16:08:34 UTC

[jira] Updated: (PIG-69) NullPointerException in setJobtrackerLocation() in PigContext.java:68

     [ https://issues.apache.org/jira/browse/PIG-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Francisoud updated PIG-69:
-----------------------------------

    Attachment: PigContext-PIG-69-v01.patch

This patch fix the null pointer and allows at the same time to set more configuration parameters using IoC approach.

The problem with setting conf param with methods like "setJobtrackerLocation()" and "setFilesystemLocation()" is that you will end up adding lots of those methods filling the class with boiler plate code for each parameter :(

The client code will look like:
{code:java}
PigContext pigContext = new PigContext(ExecType.MAPREDUCE);
JobConf conf = new JobConf(configuration);
pigContext.setConf(conf);

PigServer pigServer = new PigServer(pigContext);
{code}

This patch makes setJobtrackerLocation() and setFilesystemLocation() deprecated.

> NullPointerException in setJobtrackerLocation() in PigContext.java:68
> ---------------------------------------------------------------------
>
>                 Key: PIG-69
>                 URL: https://issues.apache.org/jira/browse/PIG-69
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.1.0
>            Reporter: Benjamin Francisoud
>         Attachments: PigContext-PIG-69-v01.patch
>
>
> {noformat}
> java.lang.NullPointerException
>     at org.apache.pig.impl.PigContext.setJobtrackerLocation(PigContext.java:425)
>     ... (the rest of the stacktrace is my own servlet code)
> {noformat}
> The code:
> {code:java}
> final PigContext pigContext = new PigContext(ExecType.MAPREDUCE);
> pigContext.setJobtrackerLocation(configuration.get("mapred.job.tracker"));
> pigContext.setFilesystemLocation(configuration.get("fs.default.name"));
>         
> final PigServer pigServer = new PigServer(pigContext);
> {code}
> Where configuration is a org.apache.hadoop.conf.Configuration object initialized with spring framework.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.