Return-Path: X-Original-To: apmail-hadoop-hdfs-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-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 D3698183F6 for ; Fri, 17 Jul 2015 14:18:09 +0000 (UTC) Received: (qmail 26072 invoked by uid 500); 17 Jul 2015 14:18:04 -0000 Delivered-To: apmail-hadoop-hdfs-user-archive@hadoop.apache.org Received: (qmail 25932 invoked by uid 500); 17 Jul 2015 14:18:04 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 25921 invoked by uid 99); 17 Jul 2015 14:18:04 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jul 2015 14:18:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 93667D5653 for ; Fri, 17 Jul 2015 14:18:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.9 X-Spam-Level: *** X-Spam-Status: No, score=3.9 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, KAM_LIVE=1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id fqAfZK9GpHLg for ; Fri, 17 Jul 2015 14:17:52 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 2D2CF205B1 for ; Fri, 17 Jul 2015 14:17:52 +0000 (UTC) Received: by oibn4 with SMTP id n4so71477184oib.3 for ; Fri, 17 Jul 2015 07:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=3qfa1IwxfbksJmnRx8zSx3ip8CIz0oVe4gjeiu7tico=; b=0Nfq+HSpyoXhAAk75smBtRulOtsx570dAAGZMPy0+VeU/y4FxafINQcuk1CuBhThKG KfxTn37PjF+HjCIwtB4yGRQZ1CcOjk9/5IeYiatcZE6sOO29j8thIN52RvDdZZvpRa/G 2XqHOm+rx648dnX1p0xrJz1mIJuWO47ORdEnygGo+5YL7eLSHSLWsw17s9GbKgYi94JM f4X57Ln678xLigp6l8g4EICOnPpzzb8HwvJkYNmuAQ2IAWYJuE3CWcneNKgyaSomNAGM uB3pI54ps5FfUB/nU87RVtws2yHF0UJ9GbFb1+yxr+xdyvbwSPI1VKV1aEcBXV+hCY9Z 2Jrg== MIME-Version: 1.0 X-Received: by 10.202.55.7 with SMTP id e7mr13297097oia.56.1437142664793; Fri, 17 Jul 2015 07:17:44 -0700 (PDT) Received: by 10.76.79.233 with HTTP; Fri, 17 Jul 2015 07:17:44 -0700 (PDT) In-Reply-To: References: Date: Fri, 17 Jul 2015 10:17:44 -0400 Message-ID: Subject: Re: Fwd: Properties file not loaded with hadoop jar command From: Shahab Yunus To: "user@hadoop.apache.org" Content-Type: multipart/alternative; boundary=001a113cea2606d5d8051b12da00 --001a113cea2606d5d8051b12da00 Content-Type: text/plain; charset=UTF-8 This seems to be a Java issue rather than Hadoop? Have you seen these below, regarding intricacies involved in reading a resource file in Java jar? http://javarevisited.blogspot.com/2014/07/how-to-load-resources-from-classpath-in-java-example.html http://stackoverflow.com/questions/20389255/reading-a-resource-file-from-within-jar http://stackoverflow.com/questions/403256/how-do-i-read-a-resource-file-from-a-java-jar-file?rq=1 Regards, Shahab On Fri, Jul 17, 2015 at 10:09 AM, Harshit Mathur wrote: > Are you reading the file in map or reduce task? > On Jul 17, 2015 2:51 AM, "Nishanth S" wrote: > >> Hello, >> I have built a jar file with maven as build tool which reads properties >> from a file.I am doing this like InputStream is = >> ClassLoader.getSystemResourceAsStream(("hadoop.properties")) on start >> iup.No qonce the jar is built I could see that the properties get loaded >> when I do java -jar but when I am trying to execute the map reduce with >> hadoop jar ClassLoader.getSystemResourceAsStream returns input stream >> null.I want to keep this property file within the jar and is available in >> the classpath.Please advise if any one has met this scenario before. >> >> >> -Chinchu >> >> --001a113cea2606d5d8051b12da00 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
This seems to be a Java issue rather than Hadoop?

=
Have you seen these below, regarding intricacies involved in rea= ding a resource file in Java jar?

Regards,
Shahab

On Fri, Jul 1= 7, 2015 at 10:09 AM, Harshit Mathur <mathursharp@gmail.com> wrote:

Are you reading= the file in map or reduce task?

On Jul 17, 2015 2:51 AM, "Nishanth S" = <chinchu2884@= gmail.com> wrote:
Hello,I have built a =C2=A0jar file with maven as build tool which =C2=A0reads = properties from a =C2=A0file.I am doing this =C2=A0like =C2=A0InputStream i= s =3D ClassLoader.getSystemResourceAsStream(("hadoop.properties")= ) on start iup.No qonce the jar is built =C2=A0I could see that the propert= ies get loaded when =C2=A0I do java -jar but when I am trying to execute th= e map reduce with =C2=A0hadoop jar =C2=A0ClassLoader.getSystemResourceAsStr= eam returns input stream null.I want to keep this property file =C2=A0withi= n the jar and is available =C2=A0in the classpath.Please =C2=A0advise =C2= =A0if any one has met this scenario before.


-Chinchu


--001a113cea2606d5d8051b12da00--