Return-Path: X-Original-To: apmail-hadoop-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-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 853B2D1C6 for ; Thu, 9 Aug 2012 07:59:29 +0000 (UTC) Received: (qmail 95690 invoked by uid 500); 9 Aug 2012 07:59:25 -0000 Delivered-To: apmail-hadoop-user-archive@hadoop.apache.org Received: (qmail 95230 invoked by uid 500); 9 Aug 2012 07:59:19 -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 95218 invoked by uid 99); 9 Aug 2012 07:59:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2012 07:59:18 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dontariq@gmail.com designates 209.85.216.41 as permitted sender) Received: from [209.85.216.41] (HELO mail-qa0-f41.google.com) (209.85.216.41) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2012 07:59:13 +0000 Received: by qafk30 with SMTP id k30so41044qaf.14 for ; Thu, 09 Aug 2012 00:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=n7QDJKDVJM4f87a1WVEV7o8muiUv1bUsmE92arTTNU4=; b=ZXZrZPvRPG3Q1lKeACiIPgns8zMcGwc9K6dfSLHbPzpMBThi9rCdDIFLF+RDBIvR46 J1UgSxUefGSGrUwVuCnJPH45ooJiE+2ekCdnVx1YeMDAWYVo2gqSTcdv1oSuTRAv5sUk /UEqlI1nUpN6wGqcrwjPf491C1Td6PFKhWll8Mo8OwiSZTX/7LXpIFcRNVF6tbQFX4kK GhO/aonVGZ7XW9xIxUxvP4FQudpIaZSWKDbgZWe1alWqMwu/DIKy1Zysjoie8XgyFub2 CykCt39iJhozMAQEkSbL7q6hX8TnBXfau2XAXkXncBVf0svVvRGiR7hI7i0XvdsgTJHk F+8w== Received: by 10.224.185.198 with SMTP id cp6mr1210018qab.79.1344499133144; Thu, 09 Aug 2012 00:58:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.188.210 with HTTP; Thu, 9 Aug 2012 00:58:12 -0700 (PDT) In-Reply-To: References: From: Mohammad Tariq Date: Thu, 9 Aug 2012 13:28:12 +0530 Message-ID: Subject: Re: Question on adding Hadoop XML to Configuration Object To: user@hadoop.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hello there, Add the "conf/core-site.xml" file as well. Regards, Mohammad Tariq On Thu, Aug 9, 2012 at 12:37 PM, Chandra Mohan, Ananda Vel Murugan wrote: > Hi, > > > > I am trying to add a file to HDFS programmatically. > > > > In my code, I am adding hdfs-site.xml and other xml to Hadoop Configuration > object as follows > > > > Configuration configuration = null; > > configuration.addResource(new > URL("file:///usr/local/hadoop-1.0.2/conf/hdfs-site.xml")); > > configuration.addResource(new > Path("usr/local/hadoop-1.0.2/conf/hdfs-site.xml")); > > configuration.reloadConfiguration(); > > fileSystem = FileSystem.get(configuration); > > System.out.println(fileSystem.getName()); > > > > This code prints file system as file:/// instead of hdfs://. > > > > When I manually set HDFS configuration parameter like below, it works well > > > > //configuration.set("fs.default.name", "hdfs://10.78.32.252:54310"); > > > > How can I make my code work? Any inputs would be greatly appreciated. > > > > Regards, > > Anand.C > > > >