Return-Path: X-Original-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 219E1968A for ; Wed, 21 Sep 2011 15:22:00 +0000 (UTC) Received: (qmail 122 invoked by uid 500); 21 Sep 2011 15:21:59 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 99866 invoked by uid 500); 21 Sep 2011 15:21:59 -0000 Mailing-List: contact mapreduce-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-user@hadoop.apache.org Delivered-To: mailing list mapreduce-user@hadoop.apache.org Received: (qmail 99857 invoked by uid 99); 21 Sep 2011 15:21:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2011 15:21:59 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of joey@cloudera.com designates 209.85.161.48 as permitted sender) Received: from [209.85.161.48] (HELO mail-fx0-f48.google.com) (209.85.161.48) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2011 15:21:51 +0000 Received: by fxd23 with SMTP id 23so2537676fxd.35 for ; Wed, 21 Sep 2011 08:21:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.21.26 with SMTP id h26mr1262296fab.1.1316618422537; Wed, 21 Sep 2011 08:20:22 -0700 (PDT) Received: by 10.223.72.197 with HTTP; Wed, 21 Sep 2011 08:20:22 -0700 (PDT) In-Reply-To: References: Date: Wed, 21 Sep 2011 11:20:22 -0400 Message-ID: Subject: Re: 7 of 487 New window Print all Can JobConf object be declared global and used in mapper and reducer class From: Joey Echeverria To: mapreduce-user@hadoop.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org The map and reduce functions are running a different JVM, so they never ran the main() method. You can implement a=A0configure(JobConf job)=A0method in your map and reduce classes which will be passed the JobConf you used to launch the job. -Joey On Wed, Sep 21, 2011 at 9:36 AM, pranjal shrivastava wrote: > > pranjal shrivastava to mapreduce-user. > show details 9:12 AM (22 minutes ago) > Hi > I declared JobConf object static and globally in the main class and initi= alized it in the main function.Since it is global and static to inner mappe= r and reducer classes ,I tried to JobConf object in the mapper and reducer = function.But on doing this I find JobConf object to be null.Why is this hap= pening . > > Code is like > class wordcount{ > private static JobConf conf; > > //public static mapperclass{ > =A0=A0=A0 //I try to access conf object here which comes to be null > > } > //public static reducerclass{ > } > public static void main(String args[]){ > conf=3Dnew JobConf(wordcount.class) > //set mapper class > //setreducer class > //set job client > //launch the mappers,reducers > } > } > > Whats going wrong?Why I am not able to access conf object in mapper.I nee= d this for using distributed cache files. > > Thank you > Pranjal -- Joseph Echeverria Cloudera, Inc. 443.305.9434